Reputation: 55
I made a plugin that renders code and hooks it inside product page. I want to make it more flexible and hook that view in specific places in product description.
Is there a way to make it as shortcode, so I could put [blablabla] in product description and render it in a specific view? (do_shortcode()
equivalent in Wordpress)
So far, I render that by hooking it in the end of product description.
public function hookDisplayProductTab() {
return $this->display(__FILE__, 'maps.tpl');
}
The problem is that I don't know how make it work in an MVC environment. I just simply use the hooks in Prestashop to render code. I've no idea from where to start and what type of concept could be used.
Upvotes: 0
Views: 1842
Reputation: 4337
If you wish to change position of every module html that calls displayProductTab
hook, then look for {$HOOK_PRODUCT_TAB}
inside product.tpl
and put it in desired position.
If you wish to change the order of modules rendering displayProductTab
then go to backoffice menu Modules -> Positions
and search for productTab
position. You will see modules that are hooked to this position and you can change the display order of them.
If you wish to call your module's hook in a specific place you can call your hook inside templates like this.
{hook h='displayProductTab' mod='yourmodulename'}
This executes hookDisplayProductTab()
of your module inside templates. If for example you want to execute hook of every module, you remove the mod='yourmodulename'
part.
{hook h='displayProductTab}
If you wish to have certain parameters available inside hook, you can specify them.
{hook h='displayProductTab' mod='mymodulename' cur_page=$page_name}
And you can access the parameter in your hook.
public function hookDisplayProductTab($params)
{
$myParam = $params['cur_page'];
}
Upvotes: 1