Jump to content

Custom hook in product-list.tpl not getting variable $product


Recommended Posts

Hi,

 

I have custom hook which I add to product-list.tpl. It is added to container 

<div class="product-image-container">
{hook h="displayTagsInProductImageInProductLists" product=$product}
 
I have registered module to this hook /checked in back office module positions/
 
In tpl I can access variable $product which is record from variable $products defined by default in 
{foreach from=$products item=product name=products} in the same file above my code
 
I have created function in module which should display template
public function hookDisplayTagsInProductImageInProductLists($params)
    {
        return  $this->display(__FILE__, 'hookDisplayTags.tpl');
    }
 
I have no access to variable $product in template hookDisplayTags
 
Code in template is
<p>{$product|var_dump}</p>
 
I am getting NULL
 
If I move code from template straight into tpl I can access variable $product to make it work but I need to know if there is any way to access tpl variables inside custom hook.
 
If you have any link or explanation I will appreciate it.
 
Thank you for your help.
 
 
 
 
 
 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...