ProductsView.php
Код: Выделить всё
// Отзывы о товаре
$comments = $this->comments->get_comments(array('has_parent'=>false, 'type'=>'product', 'object_id'=>$product->id, 'approved'=>1, 'ip'=>$_SERVER['REMOTE_ADDR']));
$children = array();
foreach ($this->comments->get_comments(array('has_parent'=>true, 'type'=>'product', 'object_id'=>$product->id, 'approved'=>1, 'ip'=>$_SERVER['REMOTE_ADDR'])) as $c) {
$children[$c->parent_id][] = $c;
}
/*Вывод отзывов*/
tini_product.tpl
Код: Выделить всё
{foreach $product->$comments as $comment}
{* Якорь комментария *}
{* после добавления комментария кидает автоматически по якорю *}
<a name="comment_{$comment->id}"></a>
<div class="m-b-1{if $level > 0} admin_note{/if}" style="margin-left:{$level*20}px">
{* Имя комментария *}
<div>
<span class="h5">{$comment->name|escape}</span>
</div>
<div class="p-y-05">
{* Дата комментария *}
<span class="blog-data static">{$comment->date|date}, {$comment->date|time}</span>
{* Статус комментария *}
{if !$comment->approved}
<span class="font-weight-bold text-muted" data-language="{$translate_id['post_comment_status']}">({$lang->post_comment_status})</span>
{/if}
</div>
{* Тело комментария *}
{$comment->text|escape|nl2br}
{if isset($children[$comment->id])}
{comments_tree comments=$children[$comment->id] level=$level+1}
{/if}
</div>
{/foreach}
Выводит нет коментариев