bothygesen Posted March 2, 2012 Share Posted March 2, 2012 Hi,I want to set the maximum number of items in the shopping cart to 1.I searched online and found the following code. But it doesnt seem to work and i can not reach the who provided the code.This is the code: Edit file located at controllers/OrderController.php Go to line 45 and replace global $isVirtualCart, $orderTotal; with global $isVirtualCart, $orderTotal, $cart, $cookie; Now go to line 67 and paste below code on or after line 67 $max_items = 2; $cart_rs = mysql_query("select sum(quantity) as item_count from "._DB_PREFIX_."cart_product where id_cart='".$cart->id."'"); $row = mysql_fetch_assoc($cart_rs); $cart_count = $row["item_count"]; if ($cart_count > $max_items) { $this->step = 0; $this->errors[] = Tools::displayError('Maximum '.$max_items.' items allowed per order'); } You can change the value of variable $max_items to set your desired maximum number of items allowed in shopping cart. This code works fine with prestashop 1.4 or higher. **** can anyone give me an idea what the problem is. we are using version 1.4.6.2 all hel appreciated...Bo Thygesen SOLVED! i decided to use quantity limits module for prestashop Link to comment Share on other sites More sharing options...
El Patron Posted March 2, 2012 Share Posted March 2, 2012 after you installed the code did you set force compile to 'yes'? i.e. prefernces-->performance. Link to comment Share on other sites More sharing options...
istox Posted October 19, 2014 Share Posted October 19, 2014 Is there any code like this for prestashop 1.6? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now