- Posts: 50
- Thank you received: 1
how to get('main_div_name') from custom plugin
12 years 11 months ago #127838
by matback
how to get('main_div_name') from custom plugin was created 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
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.
12 years 11 months ago #127904
by Jerome
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.
Replied by Jerome on topic how to get('main_div_name') from custom plugin
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,
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.
12 years 11 months ago #127912
by matback
Replied by matback on topic how to get('main_div_name') from custom plugin
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
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.
12 years 11 months ago #127913
by Jerome
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.
Replied by Jerome on topic how to get('main_div_name') from custom plugin
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,
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.
12 years 11 months ago #127920
by matback
Replied by matback on topic how to get('main_div_name') from custom plugin
Thanks Jerome.
I got it working now
It actually needs both $parent and $view.
Did like this:
It does not work with only $view or $parent. It needs to be both plus $filters. How come?
/Mathias
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.
12 years 11 months ago - 12 years 11 months ago #128003
by Jerome
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.
Replied by Jerome on topic how to get('main_div_name') from custom plugin
Hi,
When in the doc it's called parent.
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,
When in the doc it's called parent.
I called it view.onBeforeProductListingLoad(&$filters,&$order,&$parent, &$select, &$select2, &$a, &$b, &$on)
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.
12 years 11 months ago - 12 years 11 months ago #128019
by matback
Replied by matback on topic how to get('main_div_name') from custom plugin
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:
Once again many thanks Jerome.
Regards
Mathias
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