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

#   Change fields shown for serials on front end vendor view

##

- **[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")**
- [![sabroso's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38789-sabroso "View sabroso's Profile") Topic Author
- [ Offline](/forum/user/38789-sabroso)

Less More

- Posts: 128
- Thank you received: 2
-
-

10 years 1 month ago [\#251649](#251649) by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile")  *[Change fields shown for serials on front end vendor view](/forum/17-serial-how-to/886768-change-fields-shown-for-serials-on-front-end-vendor-view#251649 "-- HikaShop version -- : 2.6.4 -- HikaSerial version -- : 1.10.4 -- Joomla version -- : 3.6.0 -- PHP version -- : 5.5  Hi there,  I'm trying to change the fields that are shown in the views stats.php and export.php whithin hikaserial/serialsmarket  By default this fields are shown for each row:  I want to remove &#91;&quot;user&#95;email&quot;&#93; and add two order custom fields I have created “order&#95;cust1” and “order&#95;cust2”.  I can do this with a view override but the problem is that I need to do a database query per row/serial. So if I had 1,000 serials there would be 1,000 database queries which I think it is not ideal.  I can see the query performed is the following:  Is there a way I can modify the query via a plugin event?  Many thanks")* was created by *[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")*

-- HikaShop version -- : 2.6.4
-- HikaSerial version -- : 1.10.4
-- Joomla version -- : 3.6.0
-- PHP version -- : 5.5

Hi there,

I'm trying to change the fields that are shown in the views stats.php and export.php whithin hikaserial/serialsmarket

By default this fields are shown for each row:
Code:

["serial_data"]=&gt; string(12) "fEwjmVJV5VVB" ["serial_status"]=&gt; string(8) "assigned" ["user_email"]=&gt; string(21) "mail@mail.com" ["order_number"]=&gt; string(4) "B3S9"

I want to remove ["user_email"] and add two order custom fields I have created “order_cust1” and “order_cust2”.

I can do this with a view override but the problem is that I need to do a database query per row/serial. So if I had 1,000 serials there would be 1,000 database queries which I think it is not ideal.

I can see the query performed is the following:
Code:

SELECT serial.serial_data,serial.serial_status,hk_user.user_email,hk_order.order_number FROM #__hikaserial_serial AS serial INNER JOIN #__hikashop_order AS hk_order ON serial.serial_order_id = hk_order.order_parent_id INNER JOIN #__hikashop_order_product AS hk_order_product ON (hk_order_product.order_product_id = serial.serial_order_product_id AND hk_order_product.order_id = hk_order.order_parent_id) LEFT JOIN #__hikashop_user AS hk_user ON hk_order.order_user_id = hk_user.user_id WHERE (serial.serial_pack_id = 2) AND (hk_order.order_type = 'subsale') AND (hk_order.order_vendor_id = 2) AND (hk_order_product.product_id = 3)

Is there a way I can modify the query via a plugin event?

Many thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg2NzY4LWNoYW5nZS1maWVsZHMtc2hvd24tZm9yLXNlcmlhbHMtb24tZnJvbnQtZW5kLXZlbmRvci12aWV3P3RtcGw9bWFya2Rvd24=) 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: 26400
- Thank you received: 4078
-
- [](http://obsi.dev)
-

10 years 1 month ago [\#251654](#251654) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Change fields shown for serials on front end vendor view](/forum/17-serial-how-to/886768-change-fields-shown-for-serials-on-front-end-vendor-view#251654 "-- HikaShop version -- : 2.6.4 -- HikaSerial version -- : 1.10.4 -- Joomla version -- : 3.6.0 -- PHP version -- : 5.5  Hi there,  I'm trying to change the fields that are shown in the views stats.php and export.php whithin hikaserial/serialsmarket  By default this fields are shown for each row:  I want to remove &#91;&quot;user&#95;email&quot;&#93; and add two order custom fields I have created “order&#95;cust1” and “order&#95;cust2”.  I can do this with a view override but the problem is that I need to do a database query per row/serial. So if I had 1,000 serials there would be 1,000 database queries which I think it is not ideal.  I can see the query performed is the following:  Is there a way I can modify the query via a plugin event?  Many thanks")*

Hi,

It is something we can add into the next HikaSerial release.
In the "serialmarket/view.html.php" file, at the end of the export function, just before the query is made, it it possible to add such content Code:

JPluginHelper::importPlugin('hikashop'); JPluginHelper::importPlugin('hikaserial'); JPluginHelper::importPlugin('hikamarket'); $dispatcher = JDispatcher::getInstance(); $dispatcher-&gt;trigger('onBeforeMarketSerialExport', array($pack_id, $product_id, $target_vendor_id, &amp;$select, &amp;$tables, &amp;$filters));

So you will have a trigger that you can use in a plugin.

Please note that it will also require some modifications int the function to provide "named" array.
Like replacing Code:

$select = array( 'serial.serial_data', 'serial.serial_status' );

By Code:

$select = array( 'serial_data' =&gt; 'serial.serial_data', 'serial_status' =&gt; 'serial.serial_status' );

So in the plugin you check easily the different elements, knowing which table is already link, etc.

Regards,

---

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

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

- **[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")**
- [![sabroso's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38789-sabroso "View sabroso's Profile") Topic Author
- [ Offline](/forum/user/38789-sabroso)

Less More

- Posts: 128
- Thank you received: 2
-
-

10 years 1 month ago -  10 years 1 month ago [\#251691](#251691) by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile")  Replied by *[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")* on topic *[Change fields shown for serials on front end vendor view](/forum/17-serial-how-to/886768-change-fields-shown-for-serials-on-front-end-vendor-view#251691 "-- HikaShop version -- : 2.6.4 -- HikaSerial version -- : 1.10.4 -- Joomla version -- : 3.6.0 -- PHP version -- : 5.5  Hi there,  I'm trying to change the fields that are shown in the views stats.php and export.php whithin hikaserial/serialsmarket  By default this fields are shown for each row:  I want to remove &#91;&quot;user&#95;email&quot;&#93; and add two order custom fields I have created “order&#95;cust1” and “order&#95;cust2”.  I can do this with a view override but the problem is that I need to do a database query per row/serial. So if I had 1,000 serials there would be 1,000 database queries which I think it is not ideal.  I can see the query performed is the following:  Is there a way I can modify the query via a plugin event?  Many thanks")*

Thank you very much, the trigger is enough for now since I know the order of the field I want to swap and then add some additional ones.

This sorts me out for export.php but, would it be possible to do something similar for stats.php? I need to get a couple of custom fields from the hk_order table for each of the serials.

So when looping through
Code:

foreach ($this-&gt;serials as $serial)

I would have access to Code:

$serial-&gt;order_custom1 $serial-&gt;order_custom2

from the override file for stats.php

Would this be possible with another trigger? where would it go?

Many thanks!

Last edit: 10 years 1 month ago by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg2NzY4LWNoYW5nZS1maWVsZHMtc2hvd24tZm9yLXNlcmlhbHMtb24tZnJvbnQtZW5kLXZlbmRvci12aWV3P3RtcGw9bWFya2Rvd24=) 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: 26400
- Thank you received: 4078
-
- [](http://obsi.dev)
-

10 years 1 month ago [\#251704](#251704) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Change fields shown for serials on front end vendor view](/forum/17-serial-how-to/886768-change-fields-shown-for-serials-on-front-end-vendor-view#251704 "-- HikaShop version -- : 2.6.4 -- HikaSerial version -- : 1.10.4 -- Joomla version -- : 3.6.0 -- PHP version -- : 5.5  Hi there,  I'm trying to change the fields that are shown in the views stats.php and export.php whithin hikaserial/serialsmarket  By default this fields are shown for each row:  I want to remove &#91;&quot;user&#95;email&quot;&#93; and add two order custom fields I have created “order&#95;cust1” and “order&#95;cust2”.  I can do this with a view override but the problem is that I need to do a database query per row/serial. So if I had 1,000 serials there would be 1,000 database queries which I think it is not ideal.  I can see the query performed is the following:  Is there a way I can modify the query via a plugin event?  Many thanks")*

Hi,

In the stats view, you have access to " $this-&gt;orders ".
That is how the order number can be displayed Code:

$this-&gt;orders[ (int)$serial-&gt;order_id ]-&gt;order_number

You can load your custom field directly in a local variable Code:

$query = 'SELECT hk_order.order_id, hk_order.order_custom1, hk_order.order_custom2 FROM '.hikaserial::table('shop.order').' AS hk_order WHERE hk_order.order_id IN ('.implode(',', array_keys($this-&gt;orders)).')'; $this-&gt;db-&gt;setQuery($query); $my_orders = $this-&gt;db-&gt;loadObjectList('order_id');

Regards,

---

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

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

- **[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")**
- [![sabroso's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38789-sabroso "View sabroso's Profile") Topic Author
- [ Offline](/forum/user/38789-sabroso)

Less More

- Posts: 128
- Thank you received: 2
-
-

10 years 1 month ago -  10 years 1 month ago [\#251755](#251755) by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile")  Replied by *[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")* on topic *[Change fields shown for serials on front end vendor view](/forum/17-serial-how-to/886768-change-fields-shown-for-serials-on-front-end-vendor-view#251755 "-- HikaShop version -- : 2.6.4 -- HikaSerial version -- : 1.10.4 -- Joomla version -- : 3.6.0 -- PHP version -- : 5.5  Hi there,  I'm trying to change the fields that are shown in the views stats.php and export.php whithin hikaserial/serialsmarket  By default this fields are shown for each row:  I want to remove &#91;&quot;user&#95;email&quot;&#93; and add two order custom fields I have created “order&#95;cust1” and “order&#95;cust2”.  I can do this with a view override but the problem is that I need to do a database query per row/serial. So if I had 1,000 serials there would be 1,000 database queries which I think it is not ideal.  I can see the query performed is the following:  Is there a way I can modify the query via a plugin event?  Many thanks")*

Brilliant, thank you very much.

Please add the previously discussed event trigger into view.html.php in the export function for the next Hikaserial version.

Cheers!

Last edit: 10 years 1 month ago by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg2NzY4LWNoYW5nZS1maWVsZHMtc2hvd24tZm9yLXNlcmlhbHMtb24tZnJvbnQtZW5kLXZlbmRvci12aWV3P3RtcGw9bWFya2Rvd24=) 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: 26400
- Thank you received: 4078
-
- [](http://obsi.dev)
-

10 years 1 month ago [\#251767](#251767) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Change fields shown for serials on front end vendor view](/forum/17-serial-how-to/886768-change-fields-shown-for-serials-on-front-end-vendor-view#251767 "-- HikaShop version -- : 2.6.4 -- HikaSerial version -- : 1.10.4 -- Joomla version -- : 3.6.0 -- PHP version -- : 5.5  Hi there,  I'm trying to change the fields that are shown in the views stats.php and export.php whithin hikaserial/serialsmarket  By default this fields are shown for each row:  I want to remove &#91;&quot;user&#95;email&quot;&#93; and add two order custom fields I have created “order&#95;cust1” and “order&#95;cust2”.  I can do this with a view override but the problem is that I need to do a database query per row/serial. So if I had 1,000 serials there would be 1,000 database queries which I think it is not ideal.  I can see the query performed is the following:  Is there a way I can modify the query via a plugin event?  Many thanks")*

Hi,

Sure, the patch for trigger has been already committed yesterday.

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg2NzY4LWNoYW5nZS1maWVsZHMtc2hvd24tZm9yLXNlcmlhbHMtb24tZnJvbnQtZW5kLXZlbmRvci12aWV3P3RtcGw9bWFya2Rvd24=) 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.071 seconds

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