Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Permanet Free Item In Cart


harborsales

Recommended Posts

In the reset function in includes/classes/shopping_cart.php, add a line to add that product after it clears the cart. You may also want to modify the function that updates quantities so that it only allows one of that item. Possibly other issues of which I'm not thinking at the moment.

 

Hth,

Matt

Link to comment
Share on other sites

In the reset function in includes/classes/shopping_cart.php, add a line to add that product after it clears the cart

 

Matt

 

Thanks for the reply, I am very new at this could you possibly give me an example of what the code should look like and approximately where it should go?

 

Thanks

 

Mike

Link to comment
Share on other sites

define('FREE_PRODUCT_ID', '28');
$this->add_cart(FREE_PRODUCT_ID, 1);

to includes/classes/shopping_cart.php, after (around lines 69-71):

      if (tep_session_is_registered('customer_id') && ($reset_database == true)) {
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");

and before the closing }. I think; I haven't actually tried it. You might have to fool around for a while to find the exact correct place.

 

Hth,

Matt

Link to comment
Share on other sites

define('FREE_PRODUCT_ID', '28');

$this->add_cart(FREE_PRODUCT_ID, 1);

 

to includes/classes/shopping_cart.php, after (around lines 69-71):

CODE 

    if (tep_session_is_registered('customer_id') && ($reset_database == true)) {

      tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");

      tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");

 

and before the closing }. I think; I haven't actually tried it. You might have to fool around for a while to find the exact correct place

 

 

Thanks Matt for the code I tried it the way you stated and also fooled around with it but I couldn't get it to work. The free item never would show up in the cart. Thanks again for trying to help me out, I will keep fumbling around with it and hopefully I will figure it out.

 

Mike

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...