Forums / All Other Contributions/Addons / Free Gifts-Dangling Carrot support

Free Gifts-Dangling Carrot support

Views: 48,602

Results 61 to 80 of 237
12 Jun 2009, 1:51 PM
#61
noobuser avatar

noobuser

New Zenner

Join Date:
Feb 2009
Posts:
43
Plugin Contributions:
0

Free Gifts-Dangling Carrot support

hi,
i have just installed the module today and i get this error message -

1054 Unknown column 'p.products_carrot' in 'field list'
in:
[select p.products_tax_class_id, p.products_carrot, p.products_price from zen_products p where p.products_id = '0' ]


Can somebody please help?
Thanks

15 Jun 2009, 10:29 AM
#62
noobuser avatar

noobuser

New Zenner

Join Date:
Feb 2009
Posts:
43
Plugin Contributions:
0

Re: Free Gifts-Dangling Carrot support

noobuser:

hi,
i have just installed the module today and i get this error message -

1054 Unknown column 'p.products_carrot' in 'field list'
in:
[select p.products_tax_class_id, p.products_carrot, p.products_price from zen_products p where p.products_id = '0' ]


Can somebody please help?
Thanks

No one here to help me yet ? ;-(

22 Jun 2009, 7:53 AM
#63
noobuser avatar

noobuser

New Zenner

Join Date:
Feb 2009
Posts:
43
Plugin Contributions:
0

Re: Free Gifts-Dangling Carrot support

noobuser:

No one here to help me yet ? ;-(

I still can't imagine nobody to help me here yet...
my site is still down.
Guys I really need some help.........
Thanks

22 Jun 2009, 8:37 AM
#64
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Free Gifts-Dangling Carrot support

The module should not be used in its current state.

Best to wait till a newer version is available.

The learning is in the doing.

Potent Products

22 Jun 2009, 2:45 PM
#65
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: Free Gifts-Dangling Carrot support

noobuser:

I still can't imagine nobody to help me here yet...
my site is still down.
Guys I really need some help.........
Thanks

Un-installing this and do it this way.

bkeaton:

What I am looking for its almost like this way but I don't won't them to choose a free gift I just want to through in a certain gift when they check out. Can someone help me on this?
countrycharm:

Read this and you will know how to do it.
http://www.zen-cart.com/forum/showpost.php?p=194858&postcount=11

I have had this running on my site a long time now. You can chage gifts anytime you like to.
You just need to make a page telling your customers about the free gift.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

22 Jun 2009, 10:35 PM
#66
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Re: Free Gifts-Dangling Carrot support

I just installed the module in my 1.3.8 version of my shop products page went blank for all of my products.

I guess is still no working for 1.3.8. The good thing is that I installed in a temporary location. :smile:

23 Jul 2009, 5:22 AM
#67
yozoo avatar

yozoo

New Zenner

Join Date:
Sep 2008
Posts:
10
Plugin Contributions:
0

Re: Free Gifts-Dangling Carrot support

After I installed this mod, there is a mistake on my website.

Here is the information displayed on my headline of site:

Warning: Missing argument 2 for currencies::display_price(), called in /home/dvdsclu/public_html/includes/languages/english/extra_definitions/theme/free_gifts.php on line 28 and defined in /home/dvdsclu/public_html/includes/classes/currencies.php on line 99

Warning: Missing argument 2 for currencies::display_price(), called in /home/dvdsclu/public_html/includes/languages/english/extra_definitions/theme/free_gifts.php on line 29 and defined in /home/dvdsclu/public_html/includes/classes/currencies.php on line 99

My version is 1.3.8
Need urgent help... THANKS..

23 Jul 2009, 12:34 PM
#68
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: Free Gifts-Dangling Carrot support

yozoo:

After I installed this mod, there is a mistake on my website.

Here is the information displayed on my headline of site:

Warning: Missing argument 2 for currencies::display_price(), called in /home/dvdsclu/public_html/includes/languages/english/extra_definitions/theme/free_gifts.php on line 28 and defined in /home/dvdsclu/public_html/includes/classes/currencies.php on line 99

Warning: Missing argument 2 for currencies::display_price(), called in /home/dvdsclu/public_html/includes/languages/english/extra_definitions/theme/free_gifts.php on line 29 and defined in /home/dvdsclu/public_html/includes/classes/currencies.php on line 99

My version is 1.3.8
Need urgent help... THANKS..

You need to read the above post before trying to use this. This Module is not working.

Website Rob:

The module should not be used in its current state.

Best to wait till a newer version is available.

bkeaton:

What I am looking for its almost like this way but I don't won't them to choose a free gift I just want to through in a certain gift when they check out. Can someone help me on this?
countrycharm:

Un-installing this and do it this way.

Originally Posted by countrycharm
Read this and you will know how to do it.
http://www.zen-cart.com/forum/showpo...8&postcount=11

I have had this running on my site a long time now. You can chage gifts anytime you like to.
You just need to make a page telling your customers about the free gift.

This is the only way to do it until this Module is updated.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

23 Jul 2009, 4:03 PM
#69
yozoo avatar

yozoo

New Zenner

Join Date:
Sep 2008
Posts:
10
Plugin Contributions:
0

Re: Free Gifts-Dangling Carrot support

I am so sorry to hear that... No one can help me?

When will be this mod updated? I trust this issue can be resolved, but i don't know how.

20 Aug 2009, 1:27 AM
#70
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

yozoo:

After I installed this mod, there is a mistake on my website.

Here is the information displayed on my headline of site:

Warning: Missing argument 2 for currencies::display_price(), called in /home/dvdsclu/public_html/includes/languages/english/extra_definitions/theme/free_gifts.php on line 28 and defined in /home/dvdsclu/public_html/includes/classes/currencies.php on line 99

Warning: Missing argument 2 for currencies::display_price(), called in /home/dvdsclu/public_html/includes/languages/english/extra_definitions/theme/free_gifts.php on line 29 and defined in /home/dvdsclu/public_html/includes/classes/currencies.php on line 99

My version is 1.3.8
Need urgent help... THANKS..

For those folks having problems with this error, go to includes/languages/english/extra_definitions/YOUR_TEMPLATE/free_gifts.php and on line 28 change this:

define('TEXT_FREE_GIFT', 'Free gift with ' . $currencies->display_price($product_gift->fields['threshold']) . ' purchase.');

to this:

define('TEXT_FREE_GIFT', 'Free gift with ' . $currencies->display_price($product_gift->fields['threshold'], zen_get_tax_rate($gift->fields['products_tax_class_id'])) . ' purchase.');

and on line 29 change from this:

define('TEXT_DISCOUNT_GIFT', 'Only ' . $currencies->display_price($gift->fields['products_price'], zen_get_tax_rate($gift->fields['products_tax_class_id'])) . ' with ' . $currencies->display_price($product_gift->fields['threshold']) . ' purchase.');

to this:

define('TEXT_DISCOUNT_GIFT', 'Only ' . $currencies->display_price($gift->fields['products_price'], zen_get_tax_rate($gift->fields['products_tax_class_id'])) . ' with ' . $currencies->display_price($product_gift->fields['threshold'], zen_get_tax_rate($gift->fields['products_tax_class_id'])) . ' purchase.');

There was an argument missing in the display_price function.

I have this working on 1.3.7.1 with over 100 mods, it took a couple of hours to compare and merge the files. The only thing I have left to do is to get the sidebox working, it's throwing errors.

Once I have this going with my cart I will try it out on a clean 1.3.8a and report back what needs to be done. Obviously, there are missing lines of code in a file or two, so to anyone installing this I can only recommend that you compare and merge the files instead of just uploading the dangling carrot files. It is easy to find the dangling carrot modifications, they either contain the words carrot or gift so searching on those two words will show you where they are in the altered files.

I really appreciate the effort that the author has put into this and I will help out where I can once I have 1.3.8a worked out and running correctly and will update the files in the download so they will work right.


Zen Cart and it's community are the best!!

20 Aug 2009, 5:14 AM
#71
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

Fixed the sidebox not working, this is for 1.3.7.1.

In includes/templates/YOUR_TEMPLATE/sideboxes/tpl_gifts.php on line 35 replace:

$info_box_contents = array();

with

  $row = 0;
  $col = 0;
  $list_box_contents = '';

That fixes non-gift products from showing in the sidebox. Now everything is working 100%, just need some formatting/css styling to all of the parts of this mod and I will be adding it to the live site. :clap:


Zen Cart and it's community are the best!!

20 Aug 2009, 5:22 AM
#72
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

gbnet:

I'm using zencart version 1.3.8a and in the admin the items that I added as free gifts did not appear under the Free Gifts heading. I removed this sql bit "pd.language_id = '".$languages_id."'
AND" from lines 107-108 in admin/gift_add.php and it worked. It was coming up with pd.language_id = '' and no results were being returned.

Thanks for that, I was wondering what was going on! I will add this fix to the next release, I am going to go ahead and package up my changes to update the release in the downloads. I need to try this on a clean 1.3.8a install to see if there are any other bugs first.


Zen Cart and it's community are the best!!

20 Aug 2009, 9:33 PM
#73
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

So I have just successfully installed this on a clean 1.3.8a. You CANNOT simply upload the files to your server, otherwise you will have problems that have already been described in this thread. The author has mixed 1.3.7 and 1.3.8 files in the latest release so you CANNOT upload the files as is.

What you need to do is compare the files that are overwritten. Merge ONLY those parts that have either carrot or gift in them, NOTHING ELSE!

You can upload the:

language files and extra_datafiles from both the admin and includes

the admin/includes/boxes

includes/modules/pages/shopping_cart
/main_template_vars.php

includes/modules/sideboxes/YOUR_TEMPLATE/gifts.php

and the buttons and sideboxes files in includes/templates/YOUR_TEMPLATE

since they do not overwrite anything. (if you already have tpl_shopping_cart in templates/YOUR_TEMPLATE/sideboxes then you will need to compare and merge it).

Here are the files to compare and merge:

admin/includes/functions/general.php
admin/includes/modules/category_product_listing.php
admin/includes/modules/copy_to_confirm.php
admin/includes/modules/update_product.php
admin/includes/modules/product/collect_info.php
includes/classes/shopping_cart.php
includes/functions/functions_categories.php
includes/index_filters/default_filter.php
includes/modules/pages/product_info/main_template_vars.php
includes/modules/pages/shopping_cart/header_php.php

The last step is to go to admin/gift_add.php and on line 107-108 delete this:

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

so that it will display the free gifts that you have already defined.

I will eventually package this up properly so there are no more errors and post it in the downloads section, but until then - it might be a while since I am super busy - compare and merge and DO NOT upload the files from the compare and merge list above without first comparing and merging.:D

Questions? Ask away but please do not PM me because that will not benefit the entire community.


Zen Cart and it's community are the best!!

20 Aug 2009, 10:24 PM
#74
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

lankeeyankee:

I will eventually package this up properly so there are no more errors and post it in the downloads section

Alright, well it didn't take nearly as long to package up and upload, so it's done.:D As soon as it's approved it will be available from the downloads here:

http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1145

This is for 1.3.8a, there should be no issues now but if you run into a problem please post it here.


Zen Cart and it's community are the best!!

25 Aug 2009, 3:34 AM
#75
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

I have just noticed that there is still broken functionality. When a free gift is in the cart and you change the cart value to fall below the threshold a fatal error is thrown. It has to do with the $cart->remove function call in includes/modules/pages/shopping_cart/main_template_vars.php on line 69. I am in the midst of figuring this out and will post the results soon(I hope!!) I really need to get this working so I will be devoting some time to it.

So for now, the latest release 1.3.3(whenever it is published in the downloads) is not ready for live carts.


Zen Cart and it's community are the best!!

25 Aug 2009, 6:42 AM
#76
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

OK! The error is fixed and the shopping cart is working properly now. It took me a little while to figure it out but I got there in the end and learned more about how zen cart works and PHP in general so it was a good learning lesson.:D

Anyway, the problem lies in includes/modules/pages/shopping_cart/main_template_vars.php

Right above:

$num_in_cart = $_SESSION['cart']->show_total();
```add

```php
$cart = $_SESSION['cart'];
```And then a little further down find:

```php
if ($products[$i]['id'] == $gift->fields['products_id']) { // gift already in cart
 $gift_exists = $gift->fields['products_id'];
```and add this right below:

```php
$cart->remove($gift->fields['products_id']);
```That's it! Now, when someone has a free gift already in the cart and they change the cart total so it falls below the threshold the gift will be automatically removed.

In this file you will see this line:

```php
if ( $deficit < 20 && $deficit > 0 ) {
```This is what defines when the dangling carrot message appears, you have to be within 20 of your currency for the carrot to dangle (it shows a message saying add x amount to your cart to receive this free gift). You can change 20 to whatever number you want, I have changed it to 60 so the carrot gets dangled sooner to inspire people to spend more.

I am confident that this mod is 100% ready for production use, but would appreciate some testers putting it through it's paces to make sure there aren't any unforeseen bugs. I am going to upload the newest version now. PM me your email address and I can send it over sooner, I don't know how long it might take for my version to get put in the downloads.

I am working on some new features, too. I have created a new row in the free_gift table for a threshold_group, and have modified the admin/gift_add.php page to include adding this extra field. The goal is to use the threshold group to control what gifts are shown in the shopping cart page. I don't want people having to choose through gifts for the $100 range when they have already reached the $200 threshold, etc. Assigning each gift to a group will allow for logic to call only a certain group when a threshold has been reached. I should have this feature implemented very soon and will post the results.


Zen Cart and it's community are the best!!

25 Aug 2009, 10:56 PM
#77
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

lankeeyankee:

if ($products[$i]['id'] == $gift->fields['products_id']) { // gift already in cart
$gift_exists = $gift->fields['products_id'];

> 
> ```php
$cart->remove($gift->fields['products_id']);

Disregard this part of the modification. Do NOT insert the above line, it will not work right, but still do insert the first line in my last post. This is the correct modification in it's entirety again:

Still in includes/modules/pages/shopping_cart/main_template_vars.php, find this line:

$num_in_cart = $_SESSION['cart']->show_total(); 

and insert right above it:

$cart = $_SESSION['cart']; 

Go down the file and find this line:

else {
    $near_limit = 0;
  }

and insert this right after:

 if ($products[$i]['id'] == $gift->fields['products_id'] && $num_in_cart < $gift->fields['threshold']){ $cart->remove($gift->fields['products_id']); zen_redirect(zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL')); }

I have tested and retested and retested and it works as expected. If the cart value changes and falls below the threshold and a free gift is in the cart it will automatically be removed.

The only issue that I can see right now is if a coupon or order total discount such as quantity discount is used during checkout and that brings the cart down below the threshold, the gift will not be removed. I am going to check into that to see what I need to do to change it. If anyone wants to chip in an opinion on how to do it, I am all ears!:D


Zen Cart and it's community are the best!!

27 Aug 2009, 7:48 PM
#78
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: Free Gifts-Dangling Carrot support

lankeeyankee:

The last step is to go to admin/gift_add.php and on line 107-108 delete this:

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


This bit is needed if your site has more than one language, otherwise the gift products shown on <http://yoursite/admin/gift_add.php> are repeated for each language.
27 Aug 2009, 7:53 PM
#79
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Free Gifts-Dangling Carrot support

paul3648:

Just to be clear here, are you referring to these two lines?

WHERE pd.language_id = '".$languages_id."'
AND p.products_id = fg.products_id

You can't delete these lines if your site has more than one language, otherwise the gift products shown on http://yoursite/admin/gift_add.php are repeated endlessly.

Ah, ok. I only use one language so that never came up and that fix worked for me. Does the page display correctly if you don't delete the line? The existing gifts should be displayed above the field for inserting a new gift, and should show the threshold, product name, and edit and delete buttons. It wasn't showing until I made that edit, so this is obviously not the way to go about it and I will look at the code more closely to see what the correct fix will be.

Thanks for bringing it to my attention.


Zen Cart and it's community are the best!!

27 Aug 2009, 8:49 PM
#80
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: Free Gifts-Dangling Carrot support

Yes, the display is correct with those original lines.

I've just installed this on my test site by using the compare and merge method, as well as modifying the main_template_vars.php as per your instructions to delete the gift when the cart contents fall below the threshold. If the gift item has attributes, errors are thrown up, so it's best just to remove any attributes from gift items. Otherwise it seems to work well.