HOSTCMS v.6. Вывод комментариев к товарам магазина

Выводим на Главной или отдельной странице сайта комментарии к товарам, оставляемые посетителями или покупателями.
<?php // Выводим комментарии $oComments = Core_Entity::factory('Comment'); $oComments ->queryBuilder() ->join('comment_shop_items', 'comments.id', '=', 'comment_shop_items.comment_id') ->join('shop_items', 'shop_items.id', '=', 'comment_shop_items.shop_item_id')
->where('shop_id', '=', 1) ->where('comments.active', '=', 1) ->orderBy('comments.datetime', 'DESC') ->limit(5); $aComments = $oComments->findAll(); foreach($aComments as $oComment) { $sStructurePath = $oComment->Shop_Item->Shop->Structure->getPath(); ?><p><a href="<?php echo $sStructurePath . $oComment->Shop_Item->getPath()?>"><b><?php echo htmlspecialchars($oComment->subject)?></b></a> <br />Текст: <?php echo $oComment->text?> <br />Автор: <?php echo htmlspecialchars($oComment->author)?> //Как вариант, использовать иконку: <img src="/images/user.png" /><?php echo htmlspecialchars($oComment->author)?> <br />Дата: <?php echo Core_Date::sql2date($oComment->datetime)?> //Как вариант, использовать иконку: <img src="/images/calendar.png" /><?php echo Core_Date::sql2date($oComment->datetime)?> </p><?php } ?>
Пример с доски объявлений: