As per title, i would like to show xxx item(s) sold in each product.
right now, we only have option to show how many product we had in our inventory.
any opinion to show how many product had been sold in product pages?
bump for someone to help
It’s a custom change. First you would have to track how many have been sold somewhere which is not part of the core cart. Then you’d find where $product.amount is being displayed and change it to reference a new variable that would hold the quantity sold.
in that case it just need to have some additional field(or information) like (total stock: xx → this is static) in the product.
then just give a template to show sold: $product.total - $product.amount
nah, thanks for the idea tb, however do you have an idea to put new field in the product in admin pages? or is it by default cs-cart have some kind of feature for additional information?
thanks
find the “Bestselling–Sales amount” variable and use it
edit a product, go to “addons”, find the sales amount variable (like $product.sales i don’t know which is it) and then put it somewhere in view.tpl
[quote name=‘lefaek’]find the “Bestselling–Sales amount” variable and use it
edit a product, go to “addons”, find the sales amount variable (like $product.sales i don’t know which is it) and then put it somewhere in view.tpl[/QUOTE]
do you really think bestselling addons- sales amount, can really be show in everywhere?
has anyone try this before?
I would like to do this too
some idea?
- add into addons/my_changes/func.php:
function fn_my_changes_get_product_orders($product_id, $order_status = 'C'){
$count = (int)db_get_field('SELECT SUM(a.amount) FROM ?:order_details a
LEFT JOIN ?:orders b ON a.order_id = b.order_id
WHERE a.product_id = ?i AND b.status = ?s', $product_id, $order_status );
return $count;
}
2. add in tpl:
{$product_id|fn_my_changes_get_product_orders}
3. clear cache ?cc
[ Tested on CS-Cart v.3.0.6 Professional ]
I hope that helps,
—
Valentin
@Vali the code in the point 2? “[color=#282828][font=arial, verdana, tahoma, sans-serif]2. add in tpl”[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]
[/font][/color]
{$product_id|fn_my_changes_get_product_orders}
is where?
where you wish to add
Please PM the link where you wish to add and i will help you to add it
thanks Vali! you have a PM
Add orders count orders product details page on top of price.
- same as above.
- add to skins/[SKIN_NAME]/customer/addons/my_changes/hooks/products/prices_block.pre.tpl (if is missing please add):
```php
```
if you wish bellow you can follow [url="http://forum.cs-cart.com/topic/31740-how-to-add-word-from-before-price/"]http://forum.cs-cart.com/topic/31740-how-to-add-word-from-before-price/[/url] but with the content from step 2
---
valentin
Thanks dude, I will try it.
You are welcome.