Commit b238d4635b248be6bb5dc94c5fd6eef628166187

Authored by Karnovsky A
1 parent 263381c3

-

common/modules/product/helpers/ProductHelper.php
... ... @@ -73,17 +73,7 @@ class ProductHelper extends Object {
73 73 public static function getLastProducts($as_object = false) {
74 74 $last_products = Yii::$app->session->get('last_products', []);
75 75 if ($as_object) {
76   - $_products = [];
77   - foreach(Product::find()->joinWith(['variant'])->where([Product::tableName() .'.product_id' => $last_products])->andWhere(['!=', ProductVariant::tableName() .'.stock', 0])->all() as $product) {
78   - $_products[$product->product_id] = $product;
79   - }
80   - foreach($last_products as &$last_product) {
81   - if (empty($_products[$last_product])) {
82   - unset($last_product);
83   - continue;
84   - }
85   - $last_product = $_products[$last_product];
86   - }
  76 + $last_products = Product::find()->joinWith(['variant'])->where([Product::tableName() .'.product_id' => $last_products])->andWhere(['!=', ProductVariant::tableName() .'.stock', 0])->all();
87 77 }
88 78 return array_reverse($last_products);
89 79 }
... ...
common/modules/product/widgets/views/product_smart.php
... ... @@ -11,9 +11,7 @@ use yii\helpers\Url;
11 11 '#' => 'm' .$product->enabledVariant->product_variant_id])
12 12 ?>">
13 13 <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariant->imageUrl, 'list')?>
14   - <?php if ($enabled !== false) :?>
15 14 </a>
16   - <?php endif?>
17 15 </div>
18 16 <?php if(!empty($product->is_top) || !empty($product->is_new) || !empty($product->akciya)) :?>
19 17 <ul class="product-special">
... ...
common/modules/product/widgets/views/products_block.php
... ... @@ -7,7 +7,7 @@ use yii\web\View;
7 7 <h3><?= $title?></h3>
8 8 <div class="owl-carousel">
9 9 <?php foreach($products as $product) :?>
10   - <?= $this->render('product_smart', ['product' => $product, 'enabled' => !empty($product->enabledVariant)]);?>
  10 + <?= $this->render('product_smart', ['product' => $product]);?>
11 11 <?php endforeach?>
12 12 </div>
13 13 <div class="both"></div>
... ...