Jump to content

Use module variable in any tpl


hhcj

Recommended Posts

Hello,
 
Sorry for my English. I'm newbie how developer prestashop and have a dude.
 
I have a module that write a variable in a hook of product.tpl. But i want use there variable in other templates like product_list.tpl
 
Example:
 
this code are in module tpl
{assign var="maximo" value="0"}
{assign var="minimo" value="10000"}
	
{foreach from=$product_retailers item=retailer}
	{if $retailer.price > $maximo}
		{assign var="maximo" value=$retailer.price}
	{/if}
		
	{if $retailer.price < $minimo}
		{assign var="minimo" value=$retailer.price}
	{/if}
{/foreach}

and i want use this code in product-list.tpl

 

Its possible?

 

Link to comment
Share on other sites

Thank you Razaro, thank you very much.

 

I will explain how I fix.

 

i installed next module https://mypresta.eu/modules/administration-tools/hooks-manager.html

 

in controller of module i created new function for register my hook with params. Because its different call hook from product.tpl or product_list.tpl

 

in product.tpl {hook h="prices_retailers" idproduct="{$product->id|intval}"}

in product_list.tpl {hook h="prices_retailers" idproduct=$product.id_product}

 

And works fine!!!

  • Like 1
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...