Oxfordeye Posted December 1, 2003 Share Posted December 1, 2003 Anybody know how to add a free gift to the cart when the total price exceeds a certain value i.e. ?10. Patrick Link to comment Share on other sites More sharing options...
Oxfordeye Posted December 1, 2003 Author Share Posted December 1, 2003 OK I've found this here: http://www.oscommerce.com/forums/index.php?showtopic=67978&st=0& 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 } Can anybody tell me how to set a min value of the cart before it adds the free product? Please :D Link to comment Share on other sites More sharing options...
Oxfordeye Posted December 1, 2003 Author Share Posted December 1, 2003 OK I tried the first bit of the code and it works great just paste it in like this } function reset($reset_database = false) { global $customer_id; $this->contents = array(); $this->total = 0; $this->weight = 0; define('FREE_PRODUCT_ID', '345'); $this->add_cart(FREE_PRODUCT_ID, 1); $this->content_type = false; if (tep_session_is_registered('customer_id') && ($reset_database == true)) { tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "'"); } All I need now is to only have it put in the cart if the total exceeds a set amount i.e. ?10. Anybody tell me how to do this?? Patrick Link to comment Share on other sites More sharing options...
Oxfordeye Posted December 1, 2003 Author Share Posted December 1, 2003 Sorry to go on here but the above doesn't work or I cant't get it to work! You get an error when you open a new browser instance. MS2 I give up!! :angry: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.