Latest News: (loading..)
thejungle

Dangling Carrot (Free Gift/Discount Contrib)

309 posts in this topic

I just uploaded a new new version. I wasn't aware that the link to add the gift tothe cart was not being displayed.

 

If the link is not showing, do the following to update your catalog/shopping_cart.php files. Find

$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_select_now.gif', 'Select ' . $gift['products_id'] . TEXT_NOW) . '</a>';

and replace it with

$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>';

Then find

<br>(Maximum 1 gift per order)

and add

<br>'.$link.'

after it.

 

You also need to add the new image to your files.

 

Jack

Share this post


Link to post
Share on other sites
I just uploaded a new new version. I wasn't aware that the link to add the gift tothe cart was not being displayed. 

 

If the link is not showing, do the following to update your catalog/shopping_cart.php files.  Find

$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_select_now.gif', 'Select ' . $gift['products_id'] . TEXT_NOW) . '</a>';

and replace it with

$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>';

Then find

<br>(Maximum 1 gift per order)

and add

<br>'.$link.'

after it.

 

You also need to add the new image to your files.

 

Jack

 

 

Works great thanks. Any help with the side column link to all the free offers?

 

Regards

Share this post


Link to post
Share on other sites
Works great thanks.  Any help with the side column link to all the free offers?

 

Regards

 

I am not running anything except sts and dangling carrot and pwa.

 

Yet when I add the product to my cart for a free gift I get the "Product Not Found" Error if I set the stock to "Not Available", if I make it Available then Anyone can get it.

 

What is the fix?

Share this post


Link to post
Share on other sites

When you click on the Gifts link in admin, does your gift product show up in the dropdown list? If not, then it is not set up correctly.

 

Jack

Share this post


Link to post
Share on other sites
When you click on the Gifts link in admin, does your gift product show up in the dropdown list?  If not, then it is not set up correctly.

 

Jack

 

 

I have set it back to default and followed the instructions, and still get the fault. Product doesnt appear in list when I set model as gift

Share this post


Link to post
Share on other sites

Then that is the problem. The item has to be declared starting with Gift. Is that how you have it declared?

 

Jack

Share this post


Link to post
Share on other sites
Then that is the problem. The item has to be declared starting with Gift. Is that how you have it declared?

 

Jack

 

OK got it back so that now I get the dropdown list, I can add my gift through here. Then when I click on add now it comes back with "product not found"

Share this post


Link to post
Share on other sites

Then there is something wrong with your installation of the contribution or with your shop in general. When you click on the Gifts link in admin, it reads in the database and lists all products that begin with Gift. Then, when you click add, it re-reads the same database and pulls out the same data (plus some other things) again. So if it works the first time and not the second there must be a coding problem. At least I can't imaging what else would be causing it. I would reinstall the original files changed by this contribution and then re-install it. Don't just go over what you did because it is very easy to overlook a mistake that way and will be a waste of your time.

 

Jack

Share this post


Link to post
Share on other sites

OK, one more try. When I uploaded version 1.4, I had inadvertentanly introduced a new bug. The product could not be removed from the shopping cart with Update. If you are having this problem, then you need to redo the instructions for catalog/shopping_cart.php. I apologize if I have caused anyone grief with this error. I have uploaded a new version with the correct instructions.

 

Jack

Share this post


Link to post
Share on other sites
Works great thanks.  Any help with the side column link to all the free offers?

 

Regards

I just uploaded a new version that contains an infobox to display the gift items. To update, just copy the infobox to the includes/boxes directory, add this to the includes/languages/english.php file
// free_gifts in includes/boxes/gifts/php
define('BOX_HEADING_GIFTS', 'Special Gifts');

and add this to the left or right column file

include(DIR_WS_BOXES . 'gifts.php');

 

Jack

Share this post


Link to post
Share on other sites
I just uploaded a new version that contains an infobox to display the gift items.  To update, just copy the infobox to the includes/boxes directory, add this to the includes/languages/english.php file
// free_gifts in includes/boxes/gifts/php
define('BOX_HEADING_GIFTS', 'Special Gifts');

and add this to the left or right column file

include(DIR_WS_BOXES . 'gifts.php');

 

Jack

 

Sorry mate i may be confusing you here..

 

I can add the gifts into the backend no problem, remove them, edit etc..

 

The issue I get is when you try to "Add Gift" through the shopping cart. It recognises there is a free gift, but then wont allow me to add it.

 

It works fine if I set stock to Available, but not if I set to not Available

Share this post


Link to post
Share on other sites
Sorry mate i may be confusing you here..

 

I can add the gifts into the backend no problem, remove them, edit etc..

 

The issue I get is when you try to "Add Gift" through the shopping cart. It recognises there is a free gift, but then wont allow me to add it.

 

It works fine if I set stock to Available, but not if I set to not Available

 

OK I have found my problem.

 

The product I want to use is an ebook, when I add any other gift it works fine, but as soon as I add a file as a product attribute it produces this error. I know this might not be your contrib but any ideas?

Share this post


Link to post
Share on other sites

Just to be clear, this is not my contribution. I simply made some changes to it.

 

As for your problem, I don't have an answer for you. I don't understand what you mean by "add a file as a product attribute ." But if you are talking about using a product that has attributes as a gift, I don't think that would matter. You should try isolating the problem. If you add a regular product and make it a gift you said it works. What happens then if you add an attribute to it? If it still works, go through each of the options for the two products (the one that works and the one that doesn't) and try setting them the same.

 

Jack

Share this post


Link to post
Share on other sites
Just to be clear, this is not my contribution. I simply made some changes to it.

 

As for your problem, I don't have an answer for you.  I don't understand what you mean by "add a file as a product attribute ." But if you are talking about using a product that has attributes as a gift, I don't think that would matter.  You should try isolating the problem. If you add a regular product and make it a gift you said it works. What happens then if you add an attribute to it? If it still works, go through each of the options for the two products (the one that works and the one that doesn't) and try setting them the same.

 

Jack

 

 

Sorry the product is an ebook and you can specify what the filename is in oscommerce through the attributes section. When I add this attribute to any gift product it stops the item from being added. Its blatantly a fault with something I am doing on the product.

Share this post


Link to post
Share on other sites
The issue I get is when you try to "Add Gift" through the shopping cart. It recognises there is a free gift, but then wont allow me to add it.

 

It works fine if I set stock to Available, but not if I set to not Available

 

Hi all,

This is a great contribution and I just installed it today. Everything seems to be working fine and I love the carrot "just spend x dollars more to get the gift"!

 

However, I am having the same problem, as above, although I do not have any attribute contributions added.

 

If the item is marked out of stock in the admin, the items will show as free gifts in the admin and in the catalog, but when you click on the "add" button in the shopping cart nothing happens, it only refreshes the cart. The free items show that you have reached the threshold, etc, but the button only works, if the item is marked as in stock in the admin.

 

Any ideas, anyone?

 

One more thing, I just noticed. The items cannot be removed (deleted) from my admin, at all. That is certainly not a huge issue, as I can delete them from the table easy enough. Just thought I would mention it.

 

The download I used is the most recent 1.7

 

 

As it is, I can probably use this as is. It is a great contribution! The items are linkable in the shopping cart and I can give a brief description and mention that these are "specials" and may not be purchased by themselves.

 

If anyone has any thoughts on what we may have done wrong with the admin or cart, I am all eyes. ;)

 

Peace,

Erin.

Share this post


Link to post
Share on other sites

Im wondering if somone can help me with a weird issue with this mod.

 

ive got it all setup however /admin/gift_add.php doesnt show any products in the drop down box.

 

anyone have any ideas as to why this would be???

Share this post


Link to post
Share on other sites
Im wondering if somone can help me with a weird issue with this mod.

 

ive got it all setup however /admin/gift_add.php doesnt show any products in the drop down box.

 

anyone have any ideas as to why this would be???

Hi Snowman,

I did not quite understand this, myself, at first. I have another mod that requires the product begin with gift, as well, but the "model" rather than the name.

 

This mod requires the NAME begin with Gift, Like "Gift - Free Rose Quartz", or something like that. You can duplicate any item you like and rename it to "Gift ~ whatever", and it should appear in the box. It does not matter what the "model" is, just the product name.

 

If you do have products already called Gift something, then I don't have any help to offer you.

 

Hope this helps!

 

Peace,

Erin :D

Share this post


Link to post
Share on other sites

Hi nice contrib, but how can you make this work "just spend x dollars more to get the gift"!

 

Henk

Share this post


Link to post
Share on other sites
Hi nice contrib, but how can you make this work "just spend x dollars more to get the gift"!

 

Henk

 

Sorry it works :D the $near_limit is 20

Edited by henk3001

Share this post


Link to post
Share on other sites

Hey,

 

Followed the whole thread, but still no solution for the admin side. Cannot update, edit or delete selected products.

 

One more thing:

When going over the threshold, the 'buy now' image appears. I'd also like to link the product's image to its product's info page, so people will have some idea of what gift they are getting.

I'm using the latest version, 1.7.

 

Any ideas???

Share this post


Link to post
Share on other sites
Solved my own problem.  I have the Price Break per product Mod and it uses a PriceFormatter.php function called from get_products()  to query the product list and format prices.  The products query included a WHERE clause that excluded the products_status='0'.  I modified it to do a join on the free_gifts table and see if the product existed.  Everything is working fine now.

 

 

Hi Scott,

I am having the same problem with the price break mod and gift items not showing up in the cart when a price break item is there. Could you post your fix?

I am still learning php and am afraid I might just break it.... :-"

Thanks, for your help!

 

Peace,

Erin

Share this post


Link to post
Share on other sites
Hey,

 

Followed the whole thread, but still no solution for the admin side. Cannot update, edit or delete selected products.

 

<snip>

I'm using the latest version, 1.7.

 

 

I'm having exactly the same problem - cannot update, edit or delete gifts on the admin side. I can insert new ones.

 

Anybody got a solution? Great contribution btw.

 

- Rebecca

Edited by rebelina

Share this post


Link to post
Share on other sites

I have uploaded a new version.

 

- Added link to the displayed image

- Added code to ignore out of stock gift products

 

To update from a previous version, code in catalog/shopping_cart.php and boxes/gifts.php was changed.

 

Jack

Edited by Jack_mcs

Share this post


Link to post
Share on other sites
I'm having exactly the same problem - cannot update, edit or delete gifts on the admin side.  I can insert new ones.

 

Anybody got a solution? Great contribution btw.

 

- Rebecca

I can't see a problem with the admin section. Do you get any kind of indication at all when you try to edit/delete an gift. Also, I assume you are speaking about when you try to do this in admin->catalog->Gifts. Is that correct?

 

Jack

Share this post


Link to post
Share on other sites
Im wondering if somone can help me with a weird issue with this mod.

 

ive got it all setup however /admin/gift_add.php doesnt show any products in the drop down box.

 

anyone have any ideas as to why this would be???

 

Same problem here.

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