Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How to show quantity of each product have been sold? Rate Topic   - - - - -

 
  • vidan
  • Senior Member
  • Members
  • Join Date: 11-Jan 10
  • 373 posts

Posted 07 January 2011 - 10:42 PM #1

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?

 
  • vidan
  • Senior Member
  • Members
  • Join Date: 11-Jan 10
  • 373 posts

Posted 11 January 2011 - 09:53 PM #2

bump for someone to help

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11327 posts

Posted 12 January 2011 - 07:16 AM #3

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.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • vidan
  • Senior Member
  • Members
  • Join Date: 11-Jan 10
  • 373 posts

Posted 13 January 2011 - 12:21 AM #4

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

 
  • lefaek
  • Member
  • Members
  • Join Date: 21-Dec 10
  • 36 posts

Posted 13 January 2011 - 12:28 AM #5

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
Find the best host for your ecommerce at JudgeHost.com

 
  • vidan
  • Senior Member
  • Members
  • Join Date: 11-Jan 10
  • 373 posts

Posted 18 January 2011 - 03:59 AM #6

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


do you really think bestselling addons- sales amount, can really be show in everywhere?
has anyone try this before?

 
  • Roto
  • Advanced Member
  • Banned
  • Join Date: 23-May 12
  • 127 posts

Posted 08 June 2013 - 04:25 PM #7

I would like to do this too
...

 
  • Roto
  • Advanced Member
  • Banned
  • Join Date: 23-May 12
  • 127 posts

Posted 09 June 2013 - 05:49 AM #8

some idea?
...

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1247 posts

Posted 10 June 2013 - 07:19 AM #9

1. 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

 
  • Roto
  • Advanced Member
  • Banned
  • Join Date: 23-May 12
  • 127 posts

Posted 10 June 2013 - 08:38 AM #10

@Vali the code in the point 2? "2. add in tpl"

{$product_id|fn_my_changes_get_product_orders}

is where?
...

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1247 posts

Posted 10 June 2013 - 08:45 AM #11

where you wish to add ;)
Please PM the link where you wish to add and i will help you to add it

 
  • Roto
  • Advanced Member
  • Banned
  • Join Date: 23-May 12
  • 127 posts

Posted 10 June 2013 - 08:56 AM #12

thanks Vali! you have a PM :mrgreen:
...

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1247 posts

Posted 10 June 2013 - 09:15 AM #13

Add orders count orders product details page on top of price.
1. same as above.
2. add to skins/[SKIN_NAME]/customer/addons/my_changes/hooks/products/prices_block.pre.tpl (if is missing please add):
<div class="product_orders_count">{$product.product_id|fn_my_changes_get_product_orders} {$lang.orders_count}</div>

if you wish bellow you can follow http://forum.cs-cart...m-before-price/ but with the content from step 2

---
valentin

 
  • Roto
  • Advanced Member
  • Banned
  • Join Date: 23-May 12
  • 127 posts

Posted 10 June 2013 - 09:33 AM #14

Thanks dude, I will try it.
...

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1247 posts

Posted 10 June 2013 - 11:59 AM #15

You are welcome.