It depends where you want this to show up. Here is the code for displaying sold count on product detail page.
1. at product.php file, look for following line (on the top of the file)
include_once(dirname(__FILE__).'/init.php');
add following code right AFTER above line
$product_sold = Db::getInstance()->getRow('SELECT SUM(product_quantity) as total FROM `'._DB_PREFIX_.'order_detail` where product_id = ' . $_GET['id_product']);
$smarty->assign('product_sold', $product_sold['total']);
2. At . /themes/yourthemes/product.tpl file, look for following line
<p class="price">
add following line right AFTER above line
{l s='Sold Count:'}{$product_sold} <br /><br />
And the result will look like below.
No comments:
Post a Comment