Example #1
0
                <?php 
// comments
$comments = SiteComment::model()->provider(SiteComment::TYPE_PRODUCT, $product->id);
$this->widget('comment.widgets.SiteComments', ['dataProvider' => $comments, 'type' => SiteComment::TYPE_PRODUCT, 'objectId' => $product->id]);
?>
            </div>
        </div>
    </div>
    <?php 
$this->endWidget();
?>

    <br class="clear">
    <?php 
// АЛЬТЕРНАТИВНЫЙ ВАРИАНТ portlet
if ($ids = Product::getAlternativeProducts($product->id, 20)) {
    $this->widget('ProductsGroupPortlet', ['id' => 'products-group-portlet', 'linkTitle' => 'АЛЬТЕРНАТИВНЫЙ ВАРИАНТ', 'item_count' => 5, 'portlet_width' => '800px', 'noPagination' => true, 'run_carousel' => true, 'bigImg' => 'alternative', 'arrow' => true, 'ids' => $ids, 'linkHtmlOptions' => ['class' => 'd1-d2 products-group-portlet']]);
}
?>

    <!-- С этим продуктом покупают -->
    <?php 
$hide = $product->buywithproducts ? "" : "display : none";
?>
    <div style="<?php 
echo $hide;
?>
">    
        <?php 
$this->widget('ProductsGroupPortlet', ['id' => 'buy-with-product-group', 'linkTitle' => 'С этим продуктом покупают', 'item_count' => 5, 'portlet_width' => '800px', 'noPagination' => true, 'run_carousel' => true, 'arrow' => false, 'ids' => CHtml::listData($product->buywithproducts, 'id_similar_product', 'id_similar_product'), 'linkHtmlOptions' => ['class' => 'd1-d2 products-group-portlet']]);
?>
Example #2
0
 public static function getAlternativeProductsForRecentlyViewed()
 {
     $cookie = Cookie::get(Recently::COOKIE_NAME_RESENTLY_VIEW_ITEMS);
     if ($cookie) {
         $cookie = CJSON::decode($cookie);
         $cookie = array_reverse($cookie);
         $ids = [];
         foreach ($cookie as $key => $value) {
             if (empty($ids)) {
                 $ids = Product::getAlternativeProducts($value);
             } elseif (Product::getAlternativeProducts($value)) {
                 $ids = array_merge($ids, Product::getAlternativeProducts($value));
             }
         }
         return $ids;
     }
     return false;
 }