Jump to content
thejungle

Dangling Carrot (Free Gift/Discount Contrib)

Recommended Posts

after some trial & error i just disabled the buy now function and manually entered:

$freebie[$p]['link'] = '<a href="http://www.mysite.com & # 0 4 7; product_info.php?action=buy_now&products_id=' . $gift['products_id'] . '">add free item to cart</a>';

this will likely clear any cart contents for those with cookies disabled though, but i guess that's a fix for later.

nevertheless, the item doesn't add. if i enter a different product id in place of $gift['products_id'] - the product doesn't add itself to the cart, but instead i am bounced to the product's actual page

 

 

 

now if i manually type: http://www.mysite.com/product_info.php?act...roducts_id=1640 into my address bar - it just shows me the shopping cart with this item not in there.

 

anyone know what edit i may have missed?

Edited by eww

Share this post


Link to post
Share on other sites

does anyone know how to hide the carrots from all_products.php (contribution)

 

query:

$products_query = tep_db_query("SELECT p.products_id, pd.products_name, pc.categories_id FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc WHERE p.products_id = pd.products_id AND p.products_id = pc.products_id AND p.products_status = 1 AND pd.language_id = FLOOR($languages_id) ORDER BY pd.products_name");

 

i've tried just about every combination i can think of and they all produced an error along the lines of:

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' p.products_id = pd.products_id AND p.products_carrot = 0, p.pr

SELECT p.products_carrot, p.products_id, pd.products_name, pc.categories_id FROM products p, products_description pd, products_to_categories pc WHERE p.products_carrot = 0, p.products_id = pd.products_id AND p.products_carrot = 0, p.products_id = pc.products_id AND p.products_status = 1 AND pd.language_id = FLOOR(1) ORDER BY pd.products_name

[TEP STOP]

Share this post


Link to post
Share on other sites
ras,

in catalog/shopping_cart.php look for:

	<td class="smallText" bgcolor="#FFFFFF">  
<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='.$freebie[$i]['id']

 

replace with:

	<td class="smallText">  
<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='.$freebie[$i]['id']

i also have a question:

is it possible to have the gift product added automatically to the customer's cart once they've reached the threshold?

due to my current search engine friendly url's, the buy now button doesn't seem to work.

 

 

yes you can. you set the threshold and than in the cart user will see the gifts you set to be gifts or discounted. it does not allow more than one gift per order.

i also use the sefurls and it works fine.

Share this post


Link to post
Share on other sites

I am having a small problem with this contribution, i've installed it and i believe everything should be working fine, but when i try to go to the add_gift.php page i get this error;

 

1054 - Unknown column 'fg.products_id' in 'on clause'

SELECT fg.*, p.products_id, pd.products_name FROM free_gifts fg, products p LEFT JOIN products_description pd ON (pd.products_id=fg.products_id) WHERE pd.language_id = '1' AND p.products_id = fg.products_id ORDER BY fg.threshold ASC

[TEP STOP]

 

It seems like its a problem with my database or so, but i dont know what.. does anyone have an idea?

Share this post


Link to post
Share on other sites
I am having a small problem with this contribution, i've installed it and i believe everything should be working fine, but when i try to go to the add_gift.php page i get this error;

 

1054 - Unknown column 'fg.products_id' in 'on clause'

SELECT fg.*, p.products_id, pd.products_name FROM free_gifts fg, products p LEFT JOIN products_description pd ON (pd.products_id=fg.products_id) WHERE pd.language_id = '1' AND p.products_id = fg.products_id ORDER BY fg.threshold ASC

[TEP STOP]

 

It seems like its a problem with my database or so, but i dont know what.. does anyone have an idea?

 

Upgrade MySql 4 to 5 maybe ?

Share this post


Link to post
Share on other sites

I have the same problem and the same error message! My problem is, that the sql file is not yet proper installed... Maybe someone can help me with that and maybe you have a similar problem ...

If i add the text of the free_gifts.sql to the textbox "execute SQL-Command in Database free_gifts" in PhPmyAdmin

i get the error message

SQL-Befehl:

 

INSERT INTO configuration( configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function )

VALUES (

'880', 'Gifts Image Width', 'GIFTS_IMAGE_WIDTH', '100', 'The pixel width of heading images', '4', '25', now( ) , now( ) , NULL , NULL

)

 

MySQL meldet: Dokumentation

#1146 - Table 'free_gifts.configuration' doesn't exist

 

greets

Edited by beginner3241

Share this post


Link to post
Share on other sites
I have the same problem and the same error message! My problem is, that the sql file is not yet proper installed... Maybe someone can help me with that and maybe you have a similar problem ...

If i add the text of the free_gifts.sql to the textbox "execute SQL-Command in Database free_gifts" in PhPmyAdmin

i get the error message

[/color]

 

greets

You should not try to execute it in the databse free_gifts, but in the main oscommerce database catalog!

Share this post


Link to post
Share on other sites
I am having a small problem with this contribution, i've installed it and i believe everything should be working fine, but when i try to go to the add_gift.php page i get this error;

 

1054 - Unknown column 'fg.products_id' in 'on clause'

SELECT fg.*, p.products_id, pd.products_name FROM free_gifts fg, products p LEFT JOIN products_description pd ON (pd.products_id=fg.products_id) WHERE pd.language_id = '1' AND p.products_id = fg.products_id ORDER BY fg.threshold ASC

 

 

have same problem and yes moved to mysql 5. how do i fix this?

 

Thanks

Share this post


Link to post
Share on other sites
have same problem and yes moved to mysql 5. how do i fix this?

 

Thanks

 

for those who moved to mysql 5

 

edit your admin/gift_add.php

 

line 86

 

find this

 

$gift_query = tep_db_query("SELECT fg.*, p.products_id, pd.products_name FROM " . TABLE_CARROT . " fg, products p

LEFT JOIN products_description pd ON (pd.products_id=fg.products_id)

WHERE pd.language_id = '".$languages_id."'

AND p.products_id = fg.products_id

ORDER BY fg.threshold ASC");

 

and replace with this

 

$gift_query = tep_db_query("SELECT fg.*, p.products_id, pd.products_name FROM (" . TABLE_CARROT . " fg, products p)

LEFT JOIN products_description pd ON (pd.products_id=fg.products_id)

WHERE pd.language_id = '".$languages_id."'

AND p.products_id = fg.products_id

ORDER BY fg.threshold ASC");

Share this post


Link to post
Share on other sites

one more question.

 

the current contribution (2.70)

 

does not allow to buy a carrot product if the cliet find it in the search or just click on the carrot from the infobox.

 

i dont give the carrot for free but with discounted price if the client reached the threshold, but the carrot is a product that the client may want to buy without reaching the threshold. i want him to be able to do this, just not with the carrot price but with the normal price

 

how can this be done?

 

Thanks

Share this post


Link to post
Share on other sites

would it be possible to modify this contribution to set the threshold levels based on total cart weight rather than price?

 

what i want to do is utilize the new auto-add code in v. 2.6, to automatically add a "box charge" item based on the weight of the items in the cart.

 

For example,

 

5lbs, auto-adds item (1 Bottle Box $2.99)

10lbs, auto-adds item (2 bottle box $3.99)

 

etc...

 

is this doable?

Share this post


Link to post
Share on other sites

Hi, just installed the contribution, had a few bugs but got all that worked out. My problem now though is that the "free" gift doesn't show up free at all. Comes up with the price in it, so I went back and set the price to 0.00 in the catalog/product part of admin, STILL coming up with the price. I have no idea what to do, scanned the thread and looks like this problem has happened in the past but was later on fixed with updates to the other scripts. I have the latest version installed. I don't even know where to begin looking now, looked at all the coding and it seems correct. I do have a very heavy modified site too. I'm hoping it's not conflicting with another contribution because at this point, I wouldn't even know which one, it's been a long time since I've added anything! Thank you.

Share this post


Link to post
Share on other sites

::blushing::

 

I found the problem, in case anyone has ever installed the "specials by category contribution", have to change it in there too! Sorry, looked for this a long time, figures I'd snap as soon as I posted about it lol.

 

Hi, just installed the contribution, had a few bugs but got all that worked out. My problem now though is that the "free" gift doesn't show up free at all. Comes up with the price in it, so I went back and set the price to 0.00 in the catalog/product part of admin, STILL coming up with the price. I have no idea what to do, scanned the thread and looks like this problem has happened in the past but was later on fixed with updates to the other scripts. I have the latest version installed. I don't even know where to begin looking now, looked at all the coding and it seems correct. I do have a very heavy modified site too. I'm hoping it's not conflicting with another contribution because at this point, I wouldn't even know which one, it's been a long time since I've added anything! Thank you.

Share this post


Link to post
Share on other sites

Hi,

 

I just did a fresh install of v. 2.6 and everything is working except 1 glitch. How do I get the item to go into the cart and not redirected to the product page? For now I'm using the script change that will add the product automatically to the cart, but in the future I want to offer more than one gift choice. Is there a work around for this? Has anyone figured this one out? I know it's in this string of code, but I can't figure it out.

 

$freebie[$p]['message'] .= sprintf(TEXT_QUALIFIED_FOR_GIFT, $currencies->display_price($gift['threshold'],tep_get_tax_rate($gift['products_tax_class_id'])));
$freebie[$p]['link'] = '<a href="http://www.mysite.com/product_info.php?action=buy_now&products_id=' . $gift['products_id'] . '">Add the FREE Item to My Cart</a>';
$freebie[$p]['name'] = $gift['products_name'];
$freebie[$p]['id'] = $gift['products_id'];
$freebie[$p]['image'] = $gift['products_image'];
$p++;

Edited by simplyclesha

Thanks!

Clesha

Share this post


Link to post
Share on other sites
Hi,

 

I just did a fresh install of v. 2.6 and everything is working except 1 glitch. How do I get the item to go into the cart and not redirected to the product page? For now I'm using the script change that will add the product automatically to the cart, but in the future I want to offer more than one gift choice. Is there a work around for this? Has anyone figured this one out? I know it's in this string of code, but I can't figure it out.

 

$freebie[$p]['message'] .= sprintf(TEXT_QUALIFIED_FOR_GIFT, $currencies->display_price($gift['threshold'],tep_get_tax_rate($gift['products_tax_class_id'])));
$freebie[$p]['link'] = '<a href="http://www.mysite.com/product_info.php?action=buy_now&products_id=' . $gift['products_id'] . '">Add the FREE Item to My Cart</a>';
$freebie[$p]['name'] = $gift['products_name'];
$freebie[$p]['id'] = $gift['products_id'];
$freebie[$p]['image'] = $gift['products_image'];
$p++;

 

$freebie[$p]['link'] = '<a href="http://www.mysite.com/product_info.php?action=buy_now&products_id=' . $gift['products_id'] . '">Add the FREE Item to My Cart</a>';

 

should be:

 

$freebie[$p]['link'] = '<a href="http://www.mysite.com/shopping_cart.php?action=buy_now&products_id=' . $gift['products_id'] . '">Add the FREE Item to My Cart</a>';

Edited by safoo

Share this post


Link to post
Share on other sites
$freebie[$p]['link'] = '<a href="http://www.mysite.com/product_info.php?action=buy_now&products_id=' . $gift['products_id'] . '">Add the FREE Item to My Cart</a>';

 

should be:

 

$freebie[$p]['link'] = '<a href="http://www.mysite.com/shopping_cart.php?action=buy_now&products_id=' . $gift['products_id'] . '">Add the FREE Item to My Cart</a>';

 

 

Thanks safoo.

 

I made the changes and now the add to cart button is gone and replaced with a link and it's still going to the product info page. The button is not on the info page so there is not way for them to add the item to their cart.


Thanks!

Clesha

Share this post


Link to post
Share on other sites

Hi All,

 

I've installed this, however, i am getting an error regarding a table missing in my database TABLE_CARROT

 

I cannot post the exact code at the moment as i had to swiftly rollback the contribution being as it was my live site. I checked the sql file and this product is not created, can anyone shed any light?

 

Best Regards

 

Donna

Share this post


Link to post
Share on other sites
Hi All,

 

I've installed this, however, i am getting an error regarding a table missing in my database TABLE_CARROT

 

I cannot post the exact code at the moment as i had to swiftly rollback the contribution being as it was my live site. I checked the sql file and this product is not created, can anyone shed any light?

 

Best Regards

 

Donna

I managed to sort it, i seemed to have gotten hold of an incomplete install document.

 

Best Regards

 

Donna

Share this post


Link to post
Share on other sites

I'd like to use this mod , but i want to offer exisiting products as free gifts once the threshold price is reached.

 

Is it possible to use existing products as free gifts ?

 

will I have to re-name and create a new catagorie for this ?

 

any help appreciated before i begin install...

 

thanks

Share this post


Link to post
Share on other sites

Ok , all installed and working....

 

Problem ? I have set 2 thresholds of spending , ?70 and ?100 , if the cart reaches the ?100 , 2 gifts show up ? , one for the ?70 carrot and also the ?100 gift as well ?

 

How can i only allow 1 gift per cart ?

 

cheers

Share this post


Link to post
Share on other sites

Hi,

 

I have installed dangling_carrot v2.6 and now I get the following error each time I modify or add a product to my admin page:

 

Warning: Cannot modify header information - headers already sent by (output started at /data01/anderson/public_html/catalog/admin/includes/languages/english/categories.php:222) in /data01/anderson/public_html/catalog/admin/includes/functions/general.php on line 18

 

Please can anybody help?

 

I'm not too sure what to do to resolve it :(

 

Many thanks!

 

Johanna

Share this post


Link to post
Share on other sites

I hope someone can help me with this old problem. I reinstalled this mod and it works except for the same problem I had before. When you click the gift add to cart button it takes you to the product page instead of adding the item directly to the cart. Is there a fix for this?

 

I've tried playing with this string, but it's not working:

 

	$freebie[$p]['message'] .= sprintf(TEXT_QUALIFIED_FOR_GIFT, $currencies->display_price($gift['threshold'],tep_get_tax_rate($gift['products_tax_class_id'])));
$freebie[$p]['link'] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $gift['products_id']) . '">' . tep_image_button('button_add_now.gif', 'Select ' . $gift['products_id'] ) . '</a>';
$freebie[$p]['name']			= $gift['products_name'];
$freebie[$p]['id']			  = $gift['products_id'];
$freebie[$p]['image']   		= $gift['products_image'];
$p++;

 

 

Has anyone else had this problem and figured out a fix?


Thanks!

Clesha

Share this post


Link to post
Share on other sites

is this mod supposed to handle multiple gifts?

 

i have several tiers set up. such as:

-spend over $10 get a small widget for free

-spend over $20 get a bigger widget for free

 

and so on

 

once the user has spent over $20, the $10 gift remains; so the user gets TWO gifts

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×