Jump to content

[SOLVED] Adding sold items counter on product details page PS1.6


Recommended Posts

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

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 6 months later...
  • 1 year later...
×
×
  • Create New...