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

#   onBeforeProductListingLoad() Enhancement

##

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 4 months ago -  15 years 3 months ago [\#20479](#20479) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  *[onBeforeProductListingLoad() Enhancement](/forum/2-general-talk-about-hikashop/20479-onbeforeproductlistingload-enhancement#20479 "Would it be possible to extend the call to this trigger to something like: Similarly for the onBeforeCategoryListingLoad trigger.  I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.  &#42;&#42;&#42; After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.")* was created by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")*

Would it be possible to extend the call to this trigger to something like: Code:

$dispatcher-&gt;trigger( 'onBeforeProductListingLoad', array( &amp; $filters, &amp; $order, &amp; $this) );

Similarly for the onBeforeCategoryListingLoad trigger.

I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.

*** After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.

Last edit: 15 years 3 months ago by [brainforge](/forum/user/423-brainforge "View brainforge's Profile"). Reason: Added note about Content Menu form

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIwNDc5LW9uYmVmb3JlcHJvZHVjdGxpc3Rpbmdsb2FkLWVuaGFuY2VtZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

15 years 3 months ago [\#20511](#20511) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: onBeforeProductListingLoad() Enhancement](/forum/2-general-talk-about-hikashop/20479-onbeforeproductlistingload-enhancement#20511 "Would it be possible to extend the call to this trigger to something like: Similarly for the onBeforeCategoryListingLoad trigger.  I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.  &#42;&#42;&#42; After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.")*

There are some problems with that:
1. The $this of the category trigger and of the product trigger are not the same. So it's not consistent.
2. The existing plugins which already implement these triggers will crash if called with these additional parameters if the persons developing them don't modify their code. So doing that would hinder backward compatibility.
But I see the possible applications of adding such parameters in the trigger and that indeed sound interesting.

Do you have any suggestions regarding these points ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIwNDc5LW9uYmVmb3JlcHJvZHVjdGxpc3Rpbmdsb2FkLWVuaGFuY2VtZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#20514](#20514) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: onBeforeProductListingLoad() Enhancement](/forum/2-general-talk-about-hikashop/20479-onbeforeproductlistingload-enhancement#20514 "Would it be possible to extend the call to this trigger to something like: Similarly for the onBeforeCategoryListingLoad trigger.  I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.  &#42;&#42;&#42; After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.")*

1. The 2 triggers are different, so would not be an issue.
In the plugin the functions could be defined as: Code:

function onBeforeProductListingLoad(&amp;$filters, &amp;$order, &amp;$productView){...} function onBeforeProductListingLoad(&amp;$filters, &amp;$order, &amp;$categoryView){...}

2. In my installations (currently 5.3) PHP handles variable parameters lists with additional parameters being ignored by the interpreter. Only if one where to be removed would there be a problem.

I have tested this with the following code and it worked fine: Code:

... $dispatcher-&gt;trigger( 'onBeforeProductListingLoad', array( &amp; $filters, &amp; $order, &amp; $this) ); ...

Code:

class plgHikashopBf_Search extends JPlugin{ // function onBeforeProductListingLoad(&amp;$filters, &amp;$order, &amp;$view) { // $searchable = trim($view-&gt;params-&gt;get('searchable')); // if (empty($searchable)) return; function onBeforeProductListingLoad(&amp;$filters) { $searchable = 'product_name,product_description'; ... } }

The *searchable* parameter is an additional field I put into my template view override for the menu form.php file.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIwNDc5LW9uYmVmb3JlcHJvZHVjdGxpc3Rpbmdsb2FkLWVuaGFuY2VtZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

15 years 3 months ago [\#20542](#20542) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: onBeforeProductListingLoad() Enhancement](/forum/2-general-talk-about-hikashop/20479-onbeforeproductlistingload-enhancement#20542 "Would it be possible to extend the call to this trigger to something like: Similarly for the onBeforeCategoryListingLoad trigger.  I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.  &#42;&#42;&#42; After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.")*

Great then. We'll do that.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIwNDc5LW9uYmVmb3JlcHJvZHVjdGxpc3Rpbmdsb2FkLWVuaGFuY2VtZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#20555](#20555) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: onBeforeProductListingLoad() Enhancement](/forum/2-general-talk-about-hikashop/20479-onbeforeproductlistingload-enhancement#20555 "Would it be possible to extend the call to this trigger to something like: Similarly for the onBeforeCategoryListingLoad trigger.  I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.  &#42;&#42;&#42; After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.")*

Thanks.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIwNDc5LW9uYmVmb3JlcHJvZHVjdGxpc3Rpbmdsb2FkLWVuaGFuY2VtZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#20629](#20629) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: onBeforeProductListingLoad() Enhancement](/forum/2-general-talk-about-hikashop/20479-onbeforeproductlistingload-enhancement#20629 "Would it be possible to extend the call to this trigger to something like: Similarly for the onBeforeCategoryListingLoad trigger.  I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.  &#42;&#42;&#42; After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.")*

Just realised that the 'onBeforeProductListingLoad' trigger is called from the administration screens as well as the site screens.

The change: Code:

$dispatcher-&gt;trigger( 'onBeforeProductListingLoad', array( &amp; $filters, &amp; $order, &amp; $this) );

needs to be made to *views/product/view.html.php* in both places please.

Also, although I am not using it, I looked for the call to *'onBeforeCategoryListingLoad'* and found it in *classes/category.php* rather than *views/category/view.html.php*. Does not really matter as long as in gets called in the same manner Code:

$dispatcher-&gt;trigger( 'onBeforeCategoryListingLoad', array( &amp; $filters, &amp; $order, &amp; $this) );

.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIwNDc5LW9uYmVmb3JlcHJvZHVjdGxpc3Rpbmdsb2FkLWVuaGFuY2VtZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

15 years 3 months ago [\#20635](#20635) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: onBeforeProductListingLoad() Enhancement](/forum/2-general-talk-about-hikashop/20479-onbeforeproductlistingload-enhancement#20635 "Would it be possible to extend the call to this trigger to something like: Similarly for the onBeforeCategoryListingLoad trigger.  I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.  &#42;&#42;&#42; After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.")*

Yes. We already made the change everywhere.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIwNDc5LW9uYmVmb3JlcHJvZHVjdGxpc3Rpbmdsb2FkLWVuaGFuY2VtZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#20649](#20649) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: onBeforeProductListingLoad() Enhancement](/forum/2-general-talk-about-hikashop/20479-onbeforeproductlistingload-enhancement#20649 "Would it be possible to extend the call to this trigger to something like: Similarly for the onBeforeCategoryListingLoad trigger.  I am implementing a search facility which lists the products using the product list views, not 100% certain I would need to use this information at the moment, but providing it would give direct access to all the information related to the request.  &#42;&#42;&#42; After a bit more investigation passing $this into the plug-in would be very useful. Can modify the view template for the Display / Content Menu form (e.g. add a searchable parameter to it) which can then be checked for in the plug-in.")*

Thanks.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIwNDc5LW9uYmVmb3JlcHJvZHVjdGxpc3Rpbmdsb2FkLWVuaGFuY2VtZW50P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) 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?

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

Time to create page: 0.063 seconds

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