Jump to content

Create a global variable for use in .tpl files


João Nascimento

Recommended Posts

You question is not clear, please try to make your question more clear so that you will get answered quickly.

what variable and for what purpose. Is it using in shopping page only?

 

You can use some kind of code as following in initContent() of the page controller.

$this->context->smarty->assign('variable', $value);
Link to comment
Share on other sites

 

You question is not clear, please try to make your question more clear so that you will get answered quickly.

what variable and for what purpose. Is it using in shopping page only?

 

You can use some kind of code as following in initContent() of the page controller.

$this->context->smarty->assign('variable', $value);

 

 

In /classes/cart.php file I added a calculation to calculate me the extra value of combinations of products. I wanted to save that resulting value and call ii in a .tpl page to just display the result.

Link to comment
Share on other sites

In /classes/cart.php file I added a calculation to calculate me the extra value of combinations of products. I wanted to save that resulting value and call ii in a .tpl page to just display the result.

 

 

 

From what I see, I think the variable is per product(each product has the value), right?

If that is the case, you need to add that value to product level(each product). The smarty variable for $products should have been assigned already, you only need to add the value to the product entity.

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...