harborsales Posted November 28, 2003 Share Posted November 28, 2003 We give away free product(s) with every purchase from our store. We would like that free item to be automaticly listed into the customers cart after they put an item in. We would like it to show item # desription and price of FREE. Does anyone know if this is possible? Thanks MikeHarbor Sales Link to comment Share on other sites More sharing options...
Guest Posted November 29, 2003 Share Posted November 29, 2003 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 More sharing options...
harborsales Posted December 1, 2003 Author Share Posted December 1, 2003 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 More sharing options...
Guest Posted December 1, 2003 Share Posted December 1, 2003 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 More sharing options...
harborsales Posted December 3, 2003 Author Share Posted December 3, 2003 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.