Wednesday, March 19, 2014

Prestashop / Tpl file tips

Assign a variable value in controller
$value = "Test value";

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

To get the variable value in tpl file
{$variable}

If conditions
{if $value}

your code

{/if}

foreach in tpl
{foreach $val as $k=>$v}

your code

{/foreach}
forloop in tpl
{for $foo=1 to 5}
your code
{/for}

No comments:

Post a Comment