azizimranz Posted June 10, 2014 Share Posted June 10, 2014 Hi All, Can anyone tell me the detailed answer how can I implement the number of sold items in product details page in PrestaShop 1.6? Thanks in advance. Link to comment Share on other sites More sharing options...
vekia Posted June 10, 2014 Share Posted June 10, 2014 in product.php class add this code public static function getNbOfSales($id_product){ $res = Db::getInstance()->getRow(' SELECT quantity FROM `'._DB_PREFIX_.'product_sale` WHERE `id_product` = '.(int)$id_product); return $res['quantity']; } then in product.tpl template file you can use: {Product::getNbOfSales($product->id)} to display product sales nb 1 1 Link to comment Share on other sites More sharing options...
azizimranz Posted June 11, 2014 Author Share Posted June 11, 2014 Hi Vekia, Thanks a lot. Its solved. Link to comment Share on other sites More sharing options...
vekia Posted June 11, 2014 Share Posted June 11, 2014 you're welcome :-) glad to hear that i could help a little with this little piece of code topic title marked as solved. with regards, Milos Link to comment Share on other sites More sharing options...
pixelhk Posted December 21, 2014 Share Posted December 21, 2014 where should i place this statement? {Product::getNbOfSales($product->id)} Link to comment Share on other sites More sharing options...
1Luciano Posted January 20, 2016 Share Posted January 20, 2016 Guess the guy who posted it doesn't seem to have an answer to it. Link to comment Share on other sites More sharing options...
Recommended Posts