Exemplo n.º 1
0
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  * @return string
  */
 public function run()
 {
     parent::run();
     $additional_filters = [function (&$query, &$cacheKeyAppend) {
         $cacheKeyAppend .= 'SimpleRelatedProducts:' . $this->model->id;
     }];
     $params = ['category_group_id' => $this->category_group_id, 'selected_category_id' => $this->selected_category_id, 'limit' => $this->limit, 'force_limit' => true, 'force_sorting' => '(product.id > ' . $this->model->id . ') DESC, id ASC', 'additional_filters' => $additional_filters];
     if ($this->viewFile !== null) {
         $params['viewFile'] = $this->viewFile;
     }
     if ($this->itemView !== null) {
         $params['itemView'] = $this->itemView;
     }
     return ProductsWidget::widget($params);
 }
Exemplo n.º 2
0
?>

<div class="container rows-padding-top-bottom-20">
    <div class="row">
        <div class="col-md-12">
            <h1 class="text-center">
                <?php 
echo isset($this->blocks['h1']) ? $this->blocks['h1'] : Yii::t('app', 'Today\'s deals');
?>
            </h1>
            <!-- here we use ProductsWidget to show the same products as in Today's deal prefiltered page -->
            <?php 
if (intval($propertyId) > 0) {
    ?>
            <?php 
    echo \app\widgets\ProductsWidget::widget(['category_group_id' => 1, 'values_by_property_id' => [$propertyId => [1]], 'limit' => 3]);
    ?>
            <?php 
} else {
    ?>
                Can't find property with key 'todays_deals'.
                Check your migrations.
            <?php 
}
?>
            <div class="text-center">
                <a href="/todays-deals" class="btn btn-primary">
                    <?php 
echo Yii::t('app', 'See all today\'s deals');
?>
                </a>