Commit 55b90fbf10c5eb107fdb05d83eef00d9dc89cf39

Authored by Karnovsky A
1 parent 5f7ba6dc

Special product block - fixes

common/components/artboxtree/ArtboxTreeBehavior.php
@@ -73,7 +73,7 @@ class ArtboxTreeBehavior extends Behavior { @@ -73,7 +73,7 @@ class ArtboxTreeBehavior extends Behavior {
73 * get all parents 73 * get all parents
74 * use MP-method 74 * use MP-method
75 */ 75 */
76 - public function getParents() { 76 + public function getParents() {
77 return $this->getParentsMP(); 77 return $this->getParentsMP();
78 } 78 }
79 79
common/modules/product/helpers/ProductHelper.php
@@ -78,7 +78,7 @@ class ProductHelper extends Object { @@ -78,7 +78,7 @@ class ProductHelper extends Object {
78 public static function getSpecialProducts($type, $count, $sort = null) { 78 public static function getSpecialProducts($type, $count, $sort = null) {
79 $data = [$type => true]; 79 $data = [$type => true];
80 return Product::find() 80 return Product::find()
81 -// ->joinWith('variants') 81 + ->innerJoinWith('variants')
82 ->where($data) 82 ->where($data)
83 // ->andWhere(['!=', ProductVariant::tableName() .'.stock', 0]) 83 // ->andWhere(['!=', ProductVariant::tableName() .'.stock', 0])
84 ->limit($count) 84 ->limit($count)
frontend/views/catalog/product.php
@@ -14,11 +14,11 @@ foreach($product->category->getParents()->all() as $parent) { @@ -14,11 +14,11 @@ foreach($product->category->getParents()->all() as $parent) {
14 $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]]; 14 $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]];
15 } 15 }
16 $this->params['breadcrumbs'][] = ['label' => $product->category->categoryName->value, 'url' => ['catalog/category', 'category' => $product->category]]; 16 $this->params['breadcrumbs'][] = ['label' => $product->category->categoryName->value, 'url' => ['catalog/category', 'category' => $product->category]];
17 -$this->params['breadcrumbs'][] = $product->name .' #'. $product->variant->sku; 17 +$this->params['breadcrumbs'][] = $product->name .' #'. @$product->variant->sku;
18 ?> 18 ?>
19 -<h1 class="open_card_item_title"><?= $product->name .' '. $product->variant->name?></h1> 19 +<h1 class="open_card_item_title"><?= $product->name .' '. @$product->variant->name?></h1>
20 20
21 -<div class="item_3_blocks_wrap" id="one_item_block" data-id="<?= $product->variant->product_variant_id?>"> <!-- flex container --> 21 +<div class="item_3_blocks_wrap" id="one_item_block" data-id="<?= @$product->variant->product_variant_id?>"> <!-- flex container -->
22 <div class="item_img_block"> <!-- блок с фотографиями --> 22 <div class="item_img_block"> <!-- блок с фотографиями -->
23 23
24 <?php if (!empty($product->images)) :?> 24 <?php if (!empty($product->images)) :?>
@@ -47,15 +47,16 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku; @@ -47,15 +47,16 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
47 47
48 <div class="busket_block"> <!-- блок с счетчиком и кнопкой добавить в корзину --> 48 <div class="busket_block"> <!-- блок с счетчиком и кнопкой добавить в корзину -->
49 <div class="top_code"> 49 <div class="top_code">
50 - <span class="code">Код: <?= $product->variant->sku?></span>  
51 - <span class="have"><img src="/images/ok_icon_green.png" alt=""><?= $product->stock !== 0 && $product->variant->price > 0 ? ' есть в наличии' : ' нет в наличии'?></span> 50 + <?php if (!empty($product->variant)) :?><span class="code">Код: <?= @$product->variant->sku?></span><?php endif?>
  51 + <span class="have"><img src="/images/ok_icon_green.png" alt=""><?= $product->stock !== 0 && @$product->variant->price > 0 ? ' есть в наличии' : ' нет в наличии'?></span>
52 </div> 52 </div>
53 53
  54 + <?php if (!empty($product->variant)) :?>
54 <div class="grey_bg"> 55 <div class="grey_bg">
55 <div class="counter"> 56 <div class="counter">
56 - <?php if ($product->variant->price > 0) :?> 57 + <?php if (@$product->variant->price > 0) :?>
57 <div class="price"> 58 <div class="price">
58 - <?= $product->variant->price?> 59 + <?= @$product->variant->price?>
59 </div> 60 </div>
60 <div class="sign">грн.</div> 61 <div class="sign">грн.</div>
61 <?php else :?> 62 <?php else :?>
@@ -73,7 +74,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku; @@ -73,7 +74,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
73 74
74 <div class="in_cart_btn"> 75 <div class="in_cart_btn">
75 <a href="#"> 76 <a href="#">
76 - <button class="cart_btn" data-id="<?= $product->variant->product_variant_id?>"> в корзину <img src="/images/ico_basket_white.png" alt=""></button> 77 + <button class="cart_btn" data-id="<?= @$product->variant->product_variant_id?>"> в корзину <img src="/images/ico_basket_white.png" alt=""></button>
77 </a> 78 </a>
78 </div> 79 </div>
79 80
@@ -89,6 +90,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku; @@ -89,6 +90,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $product-&gt;name .&#39; #&#39;. $product-&gt;variant-&gt;sku;
89 <button type="submit">заказать</button> 90 <button type="submit">заказать</button>
90 </form> 91 </form>
91 </div> 92 </div>
  93 + <?php endif?>
92 94
93 <div class="delivery"> 95 <div class="delivery">
94 <p> 96 <p>
frontend/views/orders/basket-step-02.php
@@ -27,7 +27,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -27,7 +27,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
27 <?php if (empty($item['item']->product->image)) :?> 27 <?php if (empty($item['item']->product->image)) :?>
28 <img src="/storage/no_photo.png"> 28 <img src="/storage/no_photo.png">
29 <?php else :?> 29 <?php else :?>
30 - <img src="/images/<?= $item['item']->product->image->image?>" alt="<?= $item['item']->product->image->alt ? $item['item']->product->image->alt : $item['item']->product->name?>"> 30 + <img src="/storage/products/<?= $item['item']->product->image->image?>" alt="<?= $item['item']->product->image->alt ? $item['item']->product->image->alt : $item['item']->product->name?>">
31 <?php endif?> 31 <?php endif?>
32 </div> 32 </div>
33 <div class="name_and_code"> 33 <div class="name_and_code">