[Skip to main content](#vessel-content)

#   Some statistics

##

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

8 years 2 months ago -  8 years 2 months ago [\#297633](#297633) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  *[Some statistics](/forum/19-hikamarket/895663-some-statistics#297633 "Hi, can I show total orders a single vendor has in show&#95;block&#95;characteristic.php?")* was created by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")*

Hi, can I show total orders a single vendor has in show_block_characteristic.php?

Last edit: 8 years 2 months ago by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODk1NjYzLXNvbWUtc3RhdGlzdGljcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

8 years 2 months ago [\#297639](#297639) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Some statistics](/forum/19-hikamarket/895663-some-statistics#297639 "Hi, can I show total orders a single vendor has in show&#95;block&#95;characteristic.php?")*

Hello,

You'll need to write a SQL Query to count the number of order assigned to the vendor via order_vendor_id.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODk1NjYzLXNvbWUtc3RhdGlzdGljcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

8 years 2 months ago [\#297662](#297662) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  Replied by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")* on topic *[Some statistics](/forum/19-hikamarket/895663-some-statistics#297662 "Hi, can I show total orders a single vendor has in show&#95;block&#95;characteristic.php?")*

Thanks. I made the code and worked. Can you check if I'm wrong somewhere.
Code:

&lt;?php $vendorClass = hikamarket::get('class.vendor'); $vendor_user = $vendorClass-&gt;get($variant-&gt;product_vendor_id,'vendor'); $vendor_id = $vendor_user-&gt;vendor_id; $db = JFactory::getDbo(); $query = $db-&gt;getQuery(true); $query = 'SELECT a.*, c.* FROM &#96;#__hikashop_order&#96; AS a INNER JOIN &#96;#__order_user_id&#96; AS c ON a.order_user_id = c.user_id '.'WHERE a.order_vendor_id = ' . $vendor_id . ' AND a.order_type = \'subsale\' ORDER BY a.order_id DESC'; $query = 'SELECT COUNT(*) FROM &#96;#__hikashop_order&#96; AS a WHERE a.order_vendor_id = ' . $vendor_id . ' AND a.order_type = \'subsale\''; $db-&gt;setQuery($query); $orders = $db-&gt;loadObjectList(); $orders_count = $db-&gt;loadResult(); ?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODk1NjYzLXNvbWUtc3RhdGlzdGljcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

8 years 2 months ago [\#297665](#297665) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Some statistics](/forum/19-hikamarket/895663-some-statistics#297665 "Hi, can I show total orders a single vendor has in show&#95;block&#95;characteristic.php?")*

Hello,

You can simply it a lot Code:

$vendor_id = (int)$variant-&gt;product_vendor_id; $db = JFactory::getDbo(); $query = 'SELECT COUNT(*) FROM &#96;#__hikashop_order&#96; WHERE order_vendor_id = ' . $vendor_id . ' AND order_type = '.$db-&gt;Quote('subsale'); $db-&gt;setQuery($query); $orders_count = $db-&gt;loadResult();

Afterwards, you might want to just count confirmed orders ; like it is done in HikaShop and HikaMarket.
The idea is to filter on the order_status for invoice statuses : "confirmed" and "shipped". Code:

$query .= ' AND order_status IN (\'confirmed\',\'shipped\')';

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE5LWhpa2FtYXJrZXQvODk1NjYzLXNvbWUtc3RhdGlzdGljcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.042 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
