Commit b238d4635b248be6bb5dc94c5fd6eef628166187
1 parent
263381c3
-
Showing
3 changed files
with
2 additions
and
14 deletions
Show diff stats
common/modules/product/helpers/ProductHelper.php
@@ -73,17 +73,7 @@ class ProductHelper extends Object { | @@ -73,17 +73,7 @@ class ProductHelper extends Object { | ||
73 | public static function getLastProducts($as_object = false) { | 73 | public static function getLastProducts($as_object = false) { |
74 | $last_products = Yii::$app->session->get('last_products', []); | 74 | $last_products = Yii::$app->session->get('last_products', []); |
75 | if ($as_object) { | 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 | return array_reverse($last_products); | 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,9 +11,7 @@ use yii\helpers\Url; | ||
11 | '#' => 'm' .$product->enabledVariant->product_variant_id]) | 11 | '#' => 'm' .$product->enabledVariant->product_variant_id]) |
12 | ?>"> | 12 | ?>"> |
13 | <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariant->imageUrl, 'list')?> | 13 | <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariant->imageUrl, 'list')?> |
14 | - <?php if ($enabled !== false) :?> | ||
15 | </a> | 14 | </a> |
16 | - <?php endif?> | ||
17 | </div> | 15 | </div> |
18 | <?php if(!empty($product->is_top) || !empty($product->is_new) || !empty($product->akciya)) :?> | 16 | <?php if(!empty($product->is_top) || !empty($product->is_new) || !empty($product->akciya)) :?> |
19 | <ul class="product-special"> | 17 | <ul class="product-special"> |
common/modules/product/widgets/views/products_block.php
@@ -7,7 +7,7 @@ use yii\web\View; | @@ -7,7 +7,7 @@ use yii\web\View; | ||
7 | <h3><?= $title?></h3> | 7 | <h3><?= $title?></h3> |
8 | <div class="owl-carousel"> | 8 | <div class="owl-carousel"> |
9 | <?php foreach($products as $product) :?> | 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 | <?php endforeach?> | 11 | <?php endforeach?> |
12 | </div> | 12 | </div> |
13 | <div class="both"></div> | 13 | <div class="both"></div> |