Post by markjohnson » Tue Aug 15, 2017 5:06 am

How to show the number of items sold in product page in OpenCart v3? Unfortunately, I don't have any knowledge in php or twig. I tried to find an extension as well, but no luck.

Newbie

Posts

Joined
Tue Aug 15, 2017 5:04 am

Post by IP_CAM » Tue Aug 15, 2017 11:59 am

If it does not exist, so, you'll have to get it made, if you're in a hurry,
or then wait, until possibly someone will create an Extension, one day ...
Good Luck ;)
Ernie

Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'750 FREE OC Extensions on the World's largest Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by Qphoria » Tue Aug 15, 2017 2:00 pm

The query you could use on the product page is

Code: Select all

$data['sold_count'] = $this->db->query("SELECT SUM(op.quantity) AS quantity FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) WHERE o.order_status_id > '0' AND op.product_id =  '" . (int)$product_info['product_id'] . "' GROUP BY op.product_id")->row['quantity'];
Then you'd do
<?php echo $sold_count; ?>

on the tpl or whatever the twig format is.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by cmsroom » Fri Oct 26, 2018 2:28 am


You may like these extension : - https://www.opencart.com/index.php?rout ... er=cmsroom


Newbie

Posts

Joined
Fri Sep 28, 2018 1:37 am

Post by kestas » Fri Oct 26, 2018 4:02 am

How to show the number of items sold in product page in OpenCart v3? Unfortunately, I don't have any knowledge in php or twig. I tried to find an extension as well, but no luck.
Hi

@markjohnson You can just say thank's Qphoria... and me ::) . Download attached extension and count products which are sold...
After installing this ocmod extension do not forget refresh modifications...
Cheers

I slightly edited Qphoria code, because when the product is not yet sold, we get an error.

Attachments

sold out count


Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: No registered users and 29 guests