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

#   how to get('main\_div\_name') from custom plugin

##

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

Less More

- Posts: 50
- Thank you received: 1
-
-

13 years 4 weeks ago [\#127838](#127838) by [matback](/forum/user/13291-matback "View matback's Profile")  *[how to get('main\_div\_name') from custom plugin](/forum/31-development/862790-how-to-get-main-div-name-from-custom-plugin#127838 "Hi.  I am making a plugin triggerd by onBeforeProductListingLoad(). I need to get the 'main&#95;div&#95;name' value for some processing. Eg I need to get the &quot;hikashop&#95;category&#95;information&#95;menu&#95;xxx&quot; or &quot;hikashop&#95;category&#95;information&#95;module&#95;xx&quot; value.  In the view, product listing&#95;div it gets fetched by this: $mainDivName=$this-&gt;params-&gt;get('main&#95;div&#95;name');  How to do that from the plugin? Can you please help me?  Regards  Mathias")* was created by *[matback](/forum/user/13291-matback "View matback's Profile")*

Hi.

I am making a plugin triggerd by onBeforeProductListingLoad(). I need to get the 'main_div_name' value for some processing.
Eg I need to get the "hikashop_category_information_menu_xxx" or "hikashop_category_information_module_xx" value.

In the view, product listing_div it gets fetched by this:
$mainDivName=$this-&gt;params-&gt;get('main_div_name');

How to do that from the plugin? Can you please help me?

Regards

Mathias

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2Mjc5MC1ob3ctdG8tZ2V0LW1haW4tZGl2LW5hbWUtZnJvbS1jdXN0b20tcGx1Z2luP3RtcGw9bWFya2Rvd24=) 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: 4079
-
- [](http://obsi.dev)
-

13 years 4 weeks ago [\#127904](#127904) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[how to get('main\_div\_name') from custom plugin](/forum/31-development/862790-how-to-get-main-div-name-from-custom-plugin#127904 "Hi.  I am making a plugin triggerd by onBeforeProductListingLoad(). I need to get the 'main&#95;div&#95;name' value for some processing. Eg I need to get the &quot;hikashop&#95;category&#95;information&#95;menu&#95;xxx&quot; or &quot;hikashop&#95;category&#95;information&#95;module&#95;xx&quot; value.  In the view, product listing&#95;div it gets fetched by this: $mainDivName=$this-&gt;params-&gt;get('main&#95;div&#95;name');  How to do that from the plugin? Can you please help me?  Regards  Mathias")*

Hi,

The parameter "$view" in the trigger is the "$this" in your code sample.
Be careful. You have to check if you are in the front-end or in the backend.

Regards,

---

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

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

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

Less More

- Posts: 50
- Thank you received: 1
-
-

13 years 4 weeks ago [\#127912](#127912) by [matback](/forum/user/13291-matback "View matback's Profile")  Replied by *[matback](/forum/user/13291-matback "View matback's Profile")* on topic *[how to get('main\_div\_name') from custom plugin](/forum/31-development/862790-how-to-get-main-div-name-from-custom-plugin#127912 "Hi.  I am making a plugin triggerd by onBeforeProductListingLoad(). I need to get the 'main&#95;div&#95;name' value for some processing. Eg I need to get the &quot;hikashop&#95;category&#95;information&#95;menu&#95;xxx&quot; or &quot;hikashop&#95;category&#95;information&#95;module&#95;xx&quot; value.  In the view, product listing&#95;div it gets fetched by this: $mainDivName=$this-&gt;params-&gt;get('main&#95;div&#95;name');  How to do that from the plugin? Can you please help me?  Regards  Mathias")*

On the dev page the trigger is said to be:
onBeforeProductListingLoad(&amp;$filters,&amp;$order,&amp;$parent, &amp;$select, &amp;$select2, &amp;$a, &amp;$b, &amp;$on)

No $view paramenter. Or did I missunderstand?

/Mahias

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2Mjc5MC1ob3ctdG8tZ2V0LW1haW4tZGl2LW5hbWUtZnJvbS1jdXN0b20tcGx1Z2luP3RtcGw9bWFya2Rvd24=) 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: 4079
-
- [](http://obsi.dev)
-

13 years 4 weeks ago [\#127913](#127913) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[how to get('main\_div\_name') from custom plugin](/forum/31-development/862790-how-to-get-main-div-name-from-custom-plugin#127913 "Hi.  I am making a plugin triggerd by onBeforeProductListingLoad(). I need to get the 'main&#95;div&#95;name' value for some processing. Eg I need to get the &quot;hikashop&#95;category&#95;information&#95;menu&#95;xxx&quot; or &quot;hikashop&#95;category&#95;information&#95;module&#95;xx&quot; value.  In the view, product listing&#95;div it gets fetched by this: $mainDivName=$this-&gt;params-&gt;get('main&#95;div&#95;name');  How to do that from the plugin? Can you please help me?  Regards  Mathias")*

Hi,

I called it $view in my plugins, in the documentation the variable name is $parent, but it is the same thing, the "parent view" ![:)](/media/kunena/emoticons/3.png ":)")

Regards,

---

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

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

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

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

Less More

- Posts: 50
- Thank you received: 1
-
-

13 years 4 weeks ago [\#127920](#127920) by [matback](/forum/user/13291-matback "View matback's Profile")  Replied by *[matback](/forum/user/13291-matback "View matback's Profile")* on topic *[how to get('main\_div\_name') from custom plugin](/forum/31-development/862790-how-to-get-main-div-name-from-custom-plugin#127920 "Hi.  I am making a plugin triggerd by onBeforeProductListingLoad(). I need to get the 'main&#95;div&#95;name' value for some processing. Eg I need to get the &quot;hikashop&#95;category&#95;information&#95;menu&#95;xxx&quot; or &quot;hikashop&#95;category&#95;information&#95;module&#95;xx&quot; value.  In the view, product listing&#95;div it gets fetched by this: $mainDivName=$this-&gt;params-&gt;get('main&#95;div&#95;name');  How to do that from the plugin? Can you please help me?  Regards  Mathias")*

Thanks Jerome.

I got it working now ![:)](/media/kunena/emoticons/3.png ":)")
It actually needs both $parent and $view.

Did like this: Code:

function onBeforeProductListingLoad(&amp;$filters, &amp;$parent, &amp;$view){ $app =&amp; JFactory::getApplication(); if ($app-&gt;isAdmin()){ return; } else { echo $view-&gt;params-&gt;get('main_div_name'); // TEST It works! } }

It does not work with only $view or $parent. It needs to be both plus $filters. How come?

/Mathias

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2Mjc5MC1ob3ctdG8tZ2V0LW1haW4tZGl2LW5hbWUtZnJvbS1jdXN0b20tcGx1Z2luP3RtcGw9bWFya2Rvd24=) 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: 4079
-
- [](http://obsi.dev)
-

13 years 4 weeks ago -  13 years 4 weeks ago [\#128003](#128003) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[how to get('main\_div\_name') from custom plugin](/forum/31-development/862790-how-to-get-main-div-name-from-custom-plugin#128003 "Hi.  I am making a plugin triggerd by onBeforeProductListingLoad(). I need to get the 'main&#95;div&#95;name' value for some processing. Eg I need to get the &quot;hikashop&#95;category&#95;information&#95;menu&#95;xxx&quot; or &quot;hikashop&#95;category&#95;information&#95;module&#95;xx&quot; value.  In the view, product listing&#95;div it gets fetched by this: $mainDivName=$this-&gt;params-&gt;get('main&#95;div&#95;name');  How to do that from the plugin? Can you please help me?  Regards  Mathias")*

Hi,

When in the doc it's called parent.

> onBeforeProductListingLoad(&amp;$filters,&amp;$order,**&amp;$parent**, &amp;$select, &amp;$select2, &amp;$a, &amp;$b, &amp;$on)

I called it view.

> onBeforeProductListingLoad(&amp;$filters,&amp;$order,**&amp;$view**, &amp;$select, &amp;$select2, &amp;$a, &amp;$b, &amp;$on)

But it's the same variable in the **same position**.
In your code, you "renamed" the $order into $parent. So $parent is not the parent, it's the order object...

Regards,

---

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

Last edit: 13 years 4 weeks ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

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

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

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

Less More

- Posts: 50
- Thank you received: 1
-
-

13 years 4 weeks ago -  13 years 4 weeks ago [\#128019](#128019) by [matback](/forum/user/13291-matback "View matback's Profile")  Replied by *[matback](/forum/user/13291-matback "View matback's Profile")* on topic *[how to get('main\_div\_name') from custom plugin](/forum/31-development/862790-how-to-get-main-div-name-from-custom-plugin#128019 "Hi.  I am making a plugin triggerd by onBeforeProductListingLoad(). I need to get the 'main&#95;div&#95;name' value for some processing. Eg I need to get the &quot;hikashop&#95;category&#95;information&#95;menu&#95;xxx&quot; or &quot;hikashop&#95;category&#95;information&#95;module&#95;xx&quot; value.  In the view, product listing&#95;div it gets fetched by this: $mainDivName=$this-&gt;params-&gt;get('main&#95;div&#95;name');  How to do that from the plugin? Can you please help me?  Regards  Mathias")*

Oh, I am so stupid ( after midnight brain stop) :woohoo: !!
Thanks for clarifying this too me Jerome.
Off course the parameter position is the thing and very important to get right in functions.

Just to make it "the right way." Now the code example is:
Code:

function onBeforeProductListingLoad(&amp;$filters,&amp;$order,&amp;$view, &amp;$select, &amp;$select2, &amp;$a, &amp;$b, &amp;$on){ $app =&amp; JFactory::getApplication(); if ($app-&gt;isAdmin()){ return; } else { echo $view-&gt;params-&gt;get('main_div_name'); // TEST It works! } }

Once again many thanks Jerome.

Regards

Mathias

Last edit: 13 years 4 weeks ago by [matback](/forum/user/13291-matback "View matback's Profile"). Reason: Pasting error.

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

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

Time to create page: 0.058 seconds

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