I have a Warning with "grade" in my Prestashop. I'm trying to display stars for comments on my products..
The function :
public function addGrade($id_product_comment, $grade)
{
if (!Validate::isUnsignedId($id_product_comment))
die(Tools::displayError());
if ($grade < 0)
$grade = 0;
elseif ($grade > 10)
$grade = 10;
return (Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'product_comment_grade`
(`id_product_comment`, `id_product_comment_criterion`, `grade`) VALUES(
'.(int)($id_product_comment).',
'.(int)$this->id.',
'.(int)($grade).')'));
}
Here is the tpl file :
<div id="moyenne" class="clearfix">
{section loop=6 step=1 start=1 name=average}
<span class="star" {if $bcomment.grade >= $smarty.section.average.index}style="background-position: 0 -32px;"{/if}></span>
{/section}
</div>
Since i'm in PHP 5.6, i have this :
[29-Feb-2016 12:33:40 Europe/Paris] PHP Warning: Illegal string offset 'grade' in ...file.tpl
i've tried isset() but it's not working.. How can i fix it, please ?
Thanks for reply.