praneth Posted February 17, 2013 Share Posted February 17, 2013 (edited) Hello everyone, Currently, my cart shows the number of items and not the number of products ordered. For instance, if I add 10x iPod to the cart, it will show "10 products". I would like it to show "1 product" (as it is 10 occurrences of 1 product). Would anyone know how to fix this (in v. 1.5.3)? Thanks! Edited February 17, 2013 by praneth (see edit history) Link to comment Share on other sites More sharing options...
mikal1 Posted April 28, 2013 Share Posted April 28, 2013 I have the same problem, Prestashop 1.4.8 Can somebody help to resolve this problem? Thanks Link to comment Share on other sites More sharing options...
mikal1 Posted May 13, 2013 Share Posted May 13, 2013 I make a replay of my own To display number of items in PS 1.4.8 open file /classes/cart.php find code public static function getNbProducts($id) { // Must be strictly compared to NULL, or else an empty cart will bypass the cache and add dozens of queries if (isset(self::$_nbProducts[$id]) && self::$_nbProducts[$id] !== NULL) return self::$_nbProducts[$id]; self::$_nbProducts[$id] = (int)(Db::getInstance()->getValue(' SELECT SUM(`quantity`) FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart` = '.(int)($id))); return self::$_nbProducts[$id]; } and replace with code public static function getNbProducts($id) { // Must be strictly compared to NULL, or else an empty cart will bypass the cache and add dozens of queries if (isset(self::$_nbProducts[$id]) && self::$_nbProducts[$id] !== NULL) return self::$_nbProducts[$id]; self::$_nbProducts[$id] = (int)(Db::getInstance()->getValue(' SELECT COUNT(*) FROM `'._DB_PREFIX_.'cart_product` WHERE `id_cart` = '.(int)($id))); return self::$_nbProducts[$id]; } Best wishes Link to comment Share on other sites More sharing options...
vekia Posted May 13, 2013 Share Posted May 13, 2013 Hello @mikal1 thanks for sharing your solution, i really appreciate @praneth what prestashop version you use? maybe @mikal1 solution will work for you? Link to comment Share on other sites More sharing options...
bencak Posted February 27, 2014 Share Posted February 27, 2014 Hello, this solution works only when you refresh page. When you click add to cart (let's say 10 items), it shows 10 products, but when refresh page, it shows 1 product. So does anyone know how to fix this problem ? I'm using presta 1.5.6.2. Thank you. Link to comment Share on other sites More sharing options...
Patrick Proot Posted May 19, 2016 Share Posted May 19, 2016 I replace this subject because I have the same problem and can't find the solution I test the change in query on 1.6.1.5 and it works but only after refreshing page When you click add to cart (let's say 10 items), it shows 10 products, but when refresh page, it shows 1 product. Anyone have find how to fix it since last year ? Thanks in advance Link to comment Share on other sites More sharing options...
Vosteen Posted January 3, 2017 Share Posted January 3, 2017 I'm actually working with this right now, but also have to refresh the page. Does anyone know more in 2017? (: Link to comment Share on other sites More sharing options...
vekia Posted January 3, 2017 Share Posted January 3, 2017 in what prestashop version and exactly where (can you post some screenshot where i can see it? ) Link to comment Share on other sites More sharing options...
Patrick Proot Posted January 3, 2017 Share Posted January 3, 2017 Hi Vekia For me it's version 1.6.5 Please take a look to the screenshot 1) adding 10 pieces in the card 2) display when continuing purchase 3) display after I refresh the page and Happy new year Link to comment Share on other sites More sharing options...
Vosteen Posted January 3, 2017 Share Posted January 3, 2017 I'm using 1.6.1.4. And a screenshot...hm, I don't know if it's helpful^^ I mean there is not much to see than two different numbers. When I put 12 pieces of a product to the cart, it shows 12 When I reload the page or go to a different one, the cart shows 1 - which would be correct/what I'd like to have. Link to comment Share on other sites More sharing options...
RaWMotorsports Posted January 11, 2018 Share Posted January 11, 2018 (edited) Hello, Same problem here ! I have replaced {$cart_qties} by {$products|@count} on blockcart.tpl It works very good BUT after a refresh. How to change the AJAX or JS that deal this before the refresh ? PS v1.6.1.5 Regards, Edited January 11, 2018 by RaWMotorsports (see edit history) 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