Skip to main content

how to get('main_div_name') from custom plugin

More
12 years 11 months ago #127838 by matback
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->params->get('main_div_name');

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

Regards

Mathias

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #127904 by Jerome
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 & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #127912 by matback
On the dev page the trigger is said to be:
onBeforeProductListingLoad(&$filters,&$order,&$parent, &$select, &$select2, &$a, &$b, &$on)

No $view paramenter. Or did I missunderstand?

/Mahias

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #127913 by Jerome
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" :)

Regards,

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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: matback

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #127920 by matback
Thanks Jerome.

I got it working now :)
It actually needs both $parent and $view.

Did like this:
Code:
function onBeforeProductListingLoad(&$filters, &$parent, &$view){ $app =& JFactory::getApplication(); if ($app->isAdmin()){ return; } else { echo $view->params->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 or Create an account to join the conversation.

More
12 years 11 months ago - 12 years 11 months ago #128003 by Jerome
Hi,

When in the doc it's called parent.

onBeforeProductListingLoad(&$filters,&$order,&$parent, &$select, &$select2, &$a, &$b, &$on)

I called it view.

onBeforeProductListingLoad(&$filters,&$order,&$view, &$select, &$select2, &$a, &$b, &$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 & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 12 years 11 months ago by Jerome.
The following user(s) said Thank You: matback

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago - 12 years 11 months ago #128019 by matback
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(&$filters,&$order,&$view, &$select, &$select2, &$a, &$b, &$on){ $app =& JFactory::getApplication(); if ($app->isAdmin()){ return; } else { echo $view->params->get('main_div_name'); // TEST It works! } }


Once again many thanks Jerome.

Regards

Mathias
Last edit: 12 years 11 months ago by matback. Reason: Pasting error.

Please Log in or Create an account to join the conversation.

Time to create page: 0.187 seconds
Powered by Kunena Forum