Jump to content

how can we assign an array of values to a smarty variable in prestashop 1.6.0.9 ?


Recommended Posts

My code is below i don't know how to assign it

 

check_module.php

global $smarty, $cookie, $link;
$id_product = Tools::getValue('id_product');
$sampleObj = Check_Sample::loadByIdProduct($id_product);

while($result = Db::getInstance()->getRow('
            SELECT * FROM `'._DB_PREFIX_.'check_module` sample
            WHERE sample.`id_product` = '.(int)$id_product))
{
	$smarty->assign('textarea1'=>$result['textname']);
	$smarty->assign('price1'=>$result['checkprice']);	
}
return $this->display(__FILE__, 'views/admin/sample.tpl');

And in sample.tpl


<td class="left">
<script>
{foreach $textarea1 as $color}
{$color}{/foreach}
</script>
</td>
<td class="left">
<script>
{foreach $price1 as $color1}
{$color1}{/foreach}
</script>
</td>

In the table ps_check_module contains multiple entries.

 

Please help me.

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