Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 2 votes

Dangling Carrot (Free Gift/Discount Contrib)


305 replies to this topic

#281 jester420247sl

  • Community Member
  • 45 posts
  • Real Name:Shawn

Posted 20 May 2009, 19:36

Hi,
I am getting this error when I go to "catagories" in my admin panel:

Parse error: parse error, unexpected T_STRING in /home/content/path/to/site/html/toybox/admin/includes/languages/english/categories.php on line 74

The code in my categories.php on line 74 is:

define('TEXT_PRODUCTS_DATE_AVAILABLE', 'Date Available:');

I removed the line above it which I added per the install instructions:

Quote

define('TEXT_CARROT_ISSET', 'This product is a Carrot.')

and that solved the problem. Does anyone know if this will affect how this contribution will work?

#282 jester420247sl

  • Community Member
  • 45 posts
  • Real Name:Shawn

Posted 20 May 2009, 20:15

I set up 2 different gifts, one set at $50 and the other at $150. When I had $45 worth of merchandise in my cart I was informed "Spend just $0.00 more to get ..." when in fact I had to spend $5 more. The item did not show up in the cart, but the average customer would think that they have already spent enogh for the free gift. Anyone know how to fix this glitch?

#283 jester420247sl

  • Community Member
  • 45 posts
  • Real Name:Shawn

Posted 21 May 2009, 03:26

OK, I found the fix in this thread, sorry for the double post. I now have another question. I want to set up my dangling carrot so that if a customer spends $50 they get one gift, but if they spend $150 they get another gift but not both gifts. Is this possible?

Edited by jester420247sl, 21 May 2009, 03:34.


#284 foodawgmi

  • Community Member
  • 9 posts
  • Real Name:Wladimir

Posted 30 May 2009, 04:06

View Postgirolimoni, on May 13 2009, 08:16 AM, said:

I checked and i think the remaining amount as the tax included twice. For example threshold: 100, Shopping Cart Value is 98 difference would be 2. but its 2.15 displayed. Our tax is 7.6%. 2 + 7.6% = 2.15. so i think we need to leave out the tax in the line
$freebie[$p]['message'] .= sprintf(TEXT_CLOSE_TO_FREE_GIFT, $currencies->display_price($deficit,tep_get_tax_rate($gift['products_tax_class_id'])));

To be honest, I'm not too sure on how it works with the "show prices with taxes included" part of OSC and I'm also not sure what else was changed on your installation. If I set my shop to display prices with taxes, it still works as it was intended to; it shows taxes if someone's logged in and part of any of our zones where charge taxes, or no taxes if they are not.

#285 haddock65

  • Community Member
  • 1 posts
  • Real Name:Andrew Haddock

Posted 01 July 2009, 14:38

I have installed this contribution and it is working fine apart from customers can change the quantity of the free gift in the shopping cart.

I know I must be missing something...but what ?

Can anyone help

Thanks

#286 cawamcm

  • Community Member
  • 2 posts
  • Real Name:cawamcm

Posted 19 July 2009, 17:01

When customers change quantity of product from 1 to 2, gift should increase too.
Is there any solution?

#287 kn-medien

  • Community Member
  • 24 posts
  • Real Name:neufeld

Posted 24 October 2009, 21:31

Hello,

the W3C says: Line 493, Column 714: cannot generate system identifier for general entity "action"
…ite-green-spot-p-8016.html?pid=5684&action=cust_order"></a></td> </tr><tr><t

For what is the action=cust_order&;pid=' . $gift_list ???

I have change it to action=cust_order&amp;pid=' . $gift_list but the same Error.

Another Problem: the ALT-TAG in the Gifts Box is by my Website "150" by all Gifts? Any Ideas?

MfG
Andreas from Germany

#288 moxie3

  • Community Member
  • 3 posts
  • Real Name:Beth

Posted 04 November 2009, 18:31

View Postfoodawgmi, on 12 May 2009, 05:22, said:

I took a look a the last version and it's a simple matter of the omitted parts in the query.

In your shopping cart look for the query that begins like this:

$gift_query = tep_db_query("SELECT fg.*, p.products_id, p.products_model, p.products_price, p.products_image,

Then add "
p.products_tax_class_id,
"

Next look for this line:

if ($gift['products_id'] != $gift_exists && $deficit <= 0) { // this particular gift is not in cart but qualifies

and change the line after that to this:

$freebie[$p]['message'] .= sprintf(TEXT_QUALIFIED_FOR_GIFT, $currencies->display_price($gift['threshold'],tep_get_tax_rate($gift['products_tax_class_id'])));


The change above will populate the line as it should when they've spend enough money for a gift e.g. "By spending over $100.00 you have qualified for the following gift! "

You'll have to make one more change to show folks how much they have yet to spend to get the gift:

Look for the line:

if ($gift['products_id'] != $gift_exists) { // this particular gift is not in cart

and change the line below it to:

$freebie[$p]['message'] .= sprintf(TEXT_CLOSE_TO_FREE_GIFT, $currencies->display_price($deficit,tep_get_tax_rate($gift['products_tax_class_id'])));

Sorry, I don't have line numbers to reference for you as my shopping cart page is almost completely rewritten, however, the above references should be good enough.

I just found this fix that you posted a while back... I was pulling my hair out with Dangling Carrot and this took care of my issues - any chance your fix will be included in the next release of the module? I'm sure others have had the same issues with "By spending over $0.00 you have qualified for the following gift!" not showing up properly as well as "Spend just $0.00 more to get..." not appearing correctly. You are a lifesaver!

Edited by moxie3, 04 November 2009, 18:35.


#289 misantropo

  • Community Member
  • 20 posts
  • Real Name:David

Posted 13 May 2010, 22:32

Hi,

Can I disable also purchased products only for gifts?

thanks!

#290 2 estilos

  • Community Member
  • 12 posts
  • Real Name:manuel

Posted 09 July 2010, 11:07

View Postmisantropo, on 13 May 2010, 22:32, said:

Hi,

Can I disable also purchased products only for gifts?

thanks!


Hello misantropo.
Yes you can.

It's just like it for any other module.

includes/modules/also_purchased_products.php
Just before "products_status = '1'" add "p.products_carrot = '0'".

In my case I had:

    $orders_query = tep_db_query("select p.products_id, p.products_image from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, " . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p where opa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int)$HTTP_GET_VARS['products_id'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = '1' group by p.products_id order by o.date_purchased desc limit " . MAX_DISPLAY_ALSO_PURCHASED);

and now I have this:
    $orders_query = tep_db_query("select p.products_id, p.products_image from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, " . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p where opa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int)$HTTP_GET_VARS['products_id'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_carrot = '0' and p.products_status = '1' group by p.products_id order by o.date_purchased desc limit " . MAX_DISPLAY_ALSO_PURCHASED);

______

Hola Misantropo... si que puedes yo lo acabo de hacer.

Supongo que a estas alturas ya lo tendrás resuelto pero si no arriba indico como tienes que hacerlo... espero que te sirva de ayuda.

Un saludo...

Edited by 2 estilos, 09 July 2010, 11:08.


#291 2 estilos

  • Community Member
  • 12 posts
  • Real Name:manuel

Posted 09 July 2010, 11:24

Hello everyone ... my English is very bad, I apologize. This is translated by google ... Sorry.


I have problems with the upgrade of the shopping cart with gifts.
I have installed the contribution so that the products are added automatically to the shopping cart to exceed the amount necessary (as indicated in the installation instructions). But I have problems ...


Give a gift when you make a purchase of 20 €, for example.

If you purchase an item of € 20, the gift item directly appears in the cart, as it should be ...
If I buy an article of 10 €, the gifts, as missing below € 10 in order to select the gift, Logic ...
BUT ...
If from the shopping cart quantity purchased is increased to 2 units for the 20 € of purchase, the product is automatically added as I wanted.
Not even I get the button to automatically add to the cart that gift (and still reported as missing € 10 to select the gift) TO GIVE YOU A SCREEN UPDATE.

I understand that this is the normal process of this contribution ... BUT ...
IF SOMEONE KNOWS HOW CAN I DO FOR THIS IS REALLY ALL AUTOMATIC, I will be very grateful ...


In advance ... THANK YOU FOR YOUR HELP

__________________


Hola a todos...


Doy un regalo cuando se realize una compra de 20€, por ejemplo.

Si se compra un articulo de 20€, el articulo de regalo aparece directamente en el carrito, como tiene que ser...
Si compro un articulo de 10€, el articulo de regalo, aparece abajo indicando que faltan 10€ para poder seleccionar el regalo, LOGICO...
PERO...
Si desde el carro de la compra se aumenta la cantidad comprada a 2 unidades, para obtener los 20€ de compra, el producto no se añade automáticamente como yo quisiera.
Ni tan siquiera me aparece de manera automática el botón de añadir a la cesta ese regalo (y sigue indicando que faltan 10€ para poder seleccionar el regalo) HASTA QUE LE DOY A ACTUALIZAR PANTALLA.

Entiendo que este es el proceso normal de esta contribución... PERO...
SI ALGUIEN SABE COMO PUEDO HACER PARA QUE TODO ESTO SEA REALMENTE AUTOMÁTICO, le estaré muy agradecido...


De antemano... MUCHAS GRACIAS POR VUESTRA AYUDA

#292 bonzabuy

  • Community Member
  • 85 posts
  • Real Name:Adam

Posted 04 August 2010, 08:03

Gday all! This looks great - but can anyone tell me if they have it working with no errors?
And does anyone know if it will work with the MRSP contrib that lists the RRP and the price and the savings > or will this make the Carrot contrib calculate incorrectly?

Thanks !

Edited by bonzabuy, 04 August 2010, 08:04.


#293 jfkafka

  • Community Member
  • 161 posts
  • Real Name:john kafka

Posted 25 October 2010, 15:50

Hi,

Hope all is excellent with y'all.

Two things I've encountered:
1. The carrot price is correct in shopping cart
but reverts to regular price during checkout,
anyone know what causes it/how to correct?

2. If a gift is in the cart,
another one can be added by adding a question mark to the URL:
http://www.MYSITE.com/shopping_cart.php?
and then finding the link in the link history dropdown or
simply typing it in:
eg. http://www.MYSITE.com/shopping_cart.php?action=buy_now&products_id=19

This increments the free gift by one each time the URL is navigated to.

Anyone know how to prevent this?

Thanks for any feedback.

jk

Edited by jfkafka, 25 October 2010, 15:51.


#294 papalapap

  • Community Member
  • 10 posts
  • Real Name:Ben

Posted 16 November 2010, 21:44

View Postfoodawgmi, on 12 May 2009, 05:22, said:

I took a look a the last version and it's a simple matter of the omitted parts in the query.

In your shopping cart look for the query that begins like this:

$gift_query = tep_db_query("SELECT fg.*, p.products_id, p.products_model, p.products_price, p.products_image,

Then add "
p.products_tax_class_id,
"

Next look for this line:

if ($gift['products_id'] != $gift_exists && $deficit <= 0) { // this particular gift is not in cart but qualifies

and change the line after that to this:

$freebie[$p]['message'] .= sprintf(TEXT_QUALIFIED_FOR_GIFT, $currencies->display_price($gift['threshold'],tep_get_tax_rate($gift['products_tax_class_id'])));


The change above will populate the line as it should when they've spend enough money for a gift e.g. "By spending over $100.00 you have qualified for the following gift! "

You'll have to make one more change to show folks how much they have yet to spend to get the gift:

Look for the line:

if ($gift['products_id'] != $gift_exists) { // this particular gift is not in cart

and change the line below it to:

$freebie[$p]['message'] .= sprintf(TEXT_CLOSE_TO_FREE_GIFT, $currencies->display_price($deficit,tep_get_tax_rate($gift['products_tax_class_id'])));

Sorry, I don't have line numbers to reference for you as my shopping cart page is almost completely rewritten, however, the above references should be good enough.

That helped me a lot,
but a problem which left is something with the CLOSE_TO_FREE_GIFT Function,
Threshold value for a article is 100, the close to free gift funtion only shows up when i have an amount of ~70$ in my Cart ... 50$ and under nothing shows up ... is there a percentage connection or something?

#295 kzyhu

  • Community Member
  • 2 posts
  • Real Name:Chris Janki

Posted 06 April 2011, 14:45

Hi.

My carrot sie downloadable product, but after buy, customer can't download this product. Any ideas?

#296 lp-studio

  • Community Member
  • 1 posts
  • Real Name:Luca

Posted 21 August 2011, 14:32

Thanks for this contribution!
I added the change to the inclusion of carrot automatically but I can not make a change.
If I have a list of 3 carrots into administration, the system puts all the carrots to the attainment of the quota.

I wish that in the cart should add only the carrot of the share reached
For example:
First carrot -> $ 50
According carrot -> $ 100
Third carrot -> $ 150
----------------------

if the value of the cart is $ 60 -> Automatic ONLY the first part of carrot (of course)
if the value of the cart is $ 115 -> Automatic ONLY the second part of carrot (remove the first one)
if the value of the cart is $ 200 -> Automatic ONLY part of the third carrot (remove the first and second)

I think it's a nice feature to apply to the contribution but I'm not so good :-)
Someone can help me?

thanks again

I am Italian ... thanks to google translator:-D

Edited by lp-studio, 21 August 2011, 14:34.


#297 pbor1234

  • Community Member
  • 86 posts
  • Real Name:Paul
  • Gender:Male
  • Location:The Netherlands

Posted 30 September 2011, 20:31

I was looking at the sql modifications and have doubts. It seems to be possible to filter on gifts without the additional column to products:


select count(distinct p.products_id) as total
from
products p
left join (specials s) on (p.products_id = s.products_id)
left join (products_description pd) on (p.products_id = pd.products_id and pd.language_id = '4')
<...>
left join (`free_gifts` f) on (p.products_id = f.products_id)
where
p.products_status = '1' and f.products_id IS NULL

Anyone thoughts on this?

Paul

#298 ftrippie

  • Community Member
  • 28 posts
  • Real Name:Ftrippie

Posted 05 December 2011, 19:19

Hi,

I hope you can help me. I want to combine this gift option with the discount code option. Both are now working seperately.
I only need to apply the gift option for 1 particular discount code. So I decided to hardcode this code into the shoppingcart. And that works with:
if ($num_in_cart >= $gift['threshold'] && $deficit <= 0 && strtoupper($sess_discount_code)=='xxxxx') {
...
} else if ($near_limit && strtoupper($sess_discount_code)=='xxxxx') {
....
if the customer goes in with a link with the discount code (i.e. shopdomain/?discount_code=xxxxx), it will work.

But normally the customer will enter the code on the checkout confirmation page. By that time, the shoppingcart content has not effect anymore on the order contents.
I don't mind it not showing up on the shoppingcart page (if the code is not know yet), but I would like to have the gift added and shown on the checkout confirmation page.

Any idea how to do that?

cheers...

#299 ftrippie

  • Community Member
  • 28 posts
  • Real Name:Ftrippie

Posted 05 December 2011, 19:55

BTW, just to let you know, I am using this discount module:
http://www.oscommerce.com/community/contributions,7397/category,all/search,discount

#300 ftrippie

  • Community Member
  • 28 posts
  • Real Name:Ftrippie

Posted 06 December 2011, 12:06

To continue my quest:

I tried adding the 'add-gift' code to the checkoutconfirmation page, which basically works, but it doesn't go straight to the payment page. it first returns to the checkout_shipping page, so 1 page back .

So I added the following code to the start of the checkout_confirmation page (I also tried to add to the checkout_payment page, but it has the same effect):

// test to add here: BOF //////////////////////// dangling carrot v2.0 //////////////////////////////////

if ($cart->count_contents() > 0 && strtoupper($sess_discount_code)=='xxxxx'){
// find any free gifts, and remove invalid ones
$num_in_cart = $cart->show_total();
$products = $cart->get_products();

$gift_query = tep_db_query("SELECT fg.*, p.products_id, p.products_model, p.products_price, p.products_image, p.products_tax_class_id, p.products_status, pd.products_name FROM (" . TABLE_CARROT . " fg, " . TABLE_PRODUCTS . " p)
LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (pd.products_id=fg.products_id)
WHERE pd.language_id = '".$languages_id."' AND p.products_id = fg.products_id AND p.products_status = '1' ORDER BY fg.threshold ASC");

$threshold = 0;
$p=0;
$gift_price=0;
$gift_exists=0;

while ($gift = tep_db_fetch_array($gift_query)) { // loop through the current gifts
if ($gift_exists == 0){
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if ($products[$i]['id'] == $gift['products_id']) { // gift already in cart
$gift_exists = $products[$i]['id'];
$gift_price = $gift['products_price'];
break;
}
}
}


if ($num_in_cart >= $gift['threshold']) {
// cart could qualify for this gift
// check to see if in cart already
// add to gift list if not in cart
if ($gift['products_id'] != $gift_exists ) { // this particular gift is not in cart but qualifies
if (!$cart->in_cart($gift['products_id'])) $cart->add_cart($gift['products_id']);
}
} else {
// cart cannot qualify for this gift
// remove if in cart
$cart->remove($gift['products_id']);
}
$threshold = $gift['threshold'];
}//while
}

//EOF dangling carrot v2.0