Commit c8ee17e4b148f4079eb350707d3aa19d471342c0

Authored by Administrator
1 parent 11dbe035

big commti

common/modules/product/CatalogUrlManager.php
... ... @@ -46,7 +46,7 @@ class CatalogUrlManager implements UrlRuleInterface {
46 46  
47 47 $link = 'product'.'/'. $product_variant->product->alias;
48 48 header("Status: 301");
49   - header("Location: http://www.test-22.artweb.com.ua/".$link);
  49 + header("Location: http://www.linija-svitla.ua/".$link);
50 50 die();
51 51 }
52 52 }
... ... @@ -60,7 +60,7 @@ class CatalogUrlManager implements UrlRuleInterface {
60 60  
61 61 $link = 'product'.'/'. $product_variant->product->alias;
62 62 header("Status: 301");
63   - header("Location: http://www.test-22.artweb.com.ua/".$link);
  63 + header("Location: http://www.linija-svitla.ua/".$link);
64 64 die();
65 65 }
66 66 }
... ... @@ -73,7 +73,7 @@ class CatalogUrlManager implements UrlRuleInterface {
73 73  
74 74 $link = 'product'.'/'. $product_variant->product->alias;
75 75 header("Status: 301");
76   - header("Location: http://www.test-22.artweb.com.ua/".$link);
  76 + header("Location: http://www.linija-svitla.ua/".$link);
77 77 die();
78 78 }
79 79 $sku = $old_item_name[$count-2].'/'.$old_item_name[$count-1].' '.$old_item_name[$count];
... ... @@ -82,7 +82,7 @@ class CatalogUrlManager implements UrlRuleInterface {
82 82 if($product_variant instanceof ProductVariant){
83 83 $link = 'product'.'/'. $product_variant->product->alias;
84 84 header("Status: 301");
85   - header("Location: http://www.test-22.artweb.com.ua/".$link);
  85 + header("Location: http://www.linija-svitla.ua/".$link);
86 86 die();
87 87 }
88 88  
... ... @@ -92,7 +92,7 @@ class CatalogUrlManager implements UrlRuleInterface {
92 92 if($product_variant instanceof ProductVariant){
93 93 $link = 'product'.'/'. $product_variant->product->alias;
94 94 header("Status: 301");
95   - header("Location: http://www.test-22.artweb.com.ua/".$link);
  95 + header("Location: http://www.linija-svitla.ua/".$link);
96 96 die();
97 97 }
98 98  
... ... @@ -102,7 +102,7 @@ class CatalogUrlManager implements UrlRuleInterface {
102 102 if($product_variant instanceof ProductVariant){
103 103 $link = 'product'.'/'. $product_variant->product->alias;
104 104 header("Status: 301");
105   - header("Location: http://www.test-22.artweb.com.ua/".$link);
  105 + header("Location: http://www.linija-svitla.ua/".$link);
106 106 die();
107 107 }
108 108  
... ... @@ -115,7 +115,7 @@ class CatalogUrlManager implements UrlRuleInterface {
115 115  
116 116 $link = 'product'.'/'. $product_variant->product->alias;
117 117 header("Status: 301");
118   - header("Location: http://www.test-22.artweb.com.ua/".$link);
  118 + header("Location: http://www.linija-svitla.ua/".$link);
119 119 die();
120 120 }
121 121 }
... ... @@ -127,7 +127,7 @@ class CatalogUrlManager implements UrlRuleInterface {
127 127  
128 128 $link = 'product'.'/'. $product_variant->product->alias;
129 129 header("Status: 301");
130   - header("Location: http://www.test-22.artweb.com.ua/".$link);
  130 + header("Location: http://www.linija-svitla.ua/".$link);
131 131 die();
132 132 }
133 133 }
... ...
common/modules/product/models/Category.php
... ... @@ -241,7 +241,7 @@ class Category extends \yii\db\ActiveRecord
241 241 ->innerJoin('tax_group','tax_group.tax_group_id = tax_option.tax_group_id')
242 242 ->orderBy('tax_option.sort, tax_group.sort');
243 243 return $query3->all();
244   - }, 3600*24);
  244 + }, 3600);
245 245  
246 246 }
247 247  
... ...
common/modules/product/models/Product.php
... ... @@ -153,7 +153,8 @@ class Product extends \yii\db\ActiveRecord
153 153 */
154 154 public function getImageUrl()
155 155 {
156   - $image = empty($this->variant) ? null : $this->variant->image;
  156 +
  157 + $image = !empty($this->image) ? $this->image : $this->variant->image;
157 158 return !empty($image) ? $image->imageUrl : '/storage/no_photo.png';
158 159 }
159 160  
... ...
common/modules/product/models/ProductVariant.php
... ... @@ -137,10 +137,6 @@ class ProductVariant extends \yii\db\ActiveRecord
137 137 return $this->hasMany(ProductStock::className(),['product_variant_id'=> 'product_variant_id'])->joinWith('stock');
138 138 }
139 139  
140   - public function getVariantActiveStocks(){
141   -
142   - return $this->hasMany(ProductStock::className(),['product_variant_id'=> 'product_variant_id'])->where(['quantity' > 0])->joinWith('stock');
143   - }
144 140  
145 141 public function getStocks(){
146 142  
... ...
common/modules/product/models/Stock.php
... ... @@ -68,7 +68,6 @@ class Stock extends \yii\db\ActiveRecord
68 68 'name' => Yii::t('product', 'Name'),
69 69 ];
70 70 }
71   -
72 71 /**
73 72 * @inheritdoc
74 73 * @return StockQuery the active query used by this AR class.
... ...
common/widgets/views/order.php
... ... @@ -107,7 +107,7 @@
107 107 </tr>
108 108 </table>
109 109 <div style="padding: 40px;">
110   - <center><img src="http://www.test-22.artweb.com.ua/images/new_img/new_logo.png"></center>
  110 + <center><img src="http://www.linija-svitla.ua/images/new_img/new_logo.png"></center>
111 111  
112 112 <table cellpadding="0" cellspacing="0" border="0" valign="top" style="
113 113 width: 100%; margin: 20px 0;">
... ...
frontend/models/ProductFrontendSearch.php
... ... @@ -49,6 +49,7 @@ class ProductFrontendSearch extends Product {
49 49 */
50 50 public function search($category = null, $params = [], $in_stock = true) {
51 51  
  52 +
52 53 $dataProvider = new ArrayDataProvider([
53 54 'allModels' => $this->getSearchQuery($category, $params, $in_stock)->with([
54 55 'images',
... ... @@ -89,13 +90,16 @@ class ProductFrontendSearch extends Product {
89 90 }
90 91  
91 92 public function getSearchQuery($category = null, $params = [], $in_stock = true) {
  93 +
92 94 if (!empty($category)) {
93 95 /** @var ActiveQuery $query */
94 96 /**@var Category $category **/
95 97 $query = $category->getProducts();
  98 +
96 99 } else {
97 100 $query = Product::find();
98 101 }
  102 +
99 103 $query->select(['product.*']);
100 104 $query->joinWith(['enabledVariants','brand','options', 'category']);
101 105  
... ...
frontend/views/catalog/_product_item.php
... ... @@ -34,8 +34,7 @@ use yii\helpers\Url;
34 34 ?>
35 35  
36 36 </div>
37   -
38   - <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->variant->imageUrl, 'list', [
  37 + <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list', [
39 38 'alt' => $model->category->name . ' ' . $model->name,
40 39 'title' => $model->category->name . ' ' . $model->name,
41 40 'class' => 'selected'
... ...
frontend/views/catalog/product.php
... ... @@ -657,8 +657,10 @@
657 657 <br/>
658 658 <div class="shopsList">
659 659 <ul>
660   - <?php foreach($product->variant->activeStock as $stock){?>
661   - <li><?= Html::a($stock->siteName, Url::to (['text/main', 'translit' => 'magaziny', '#'=>$stock->stock_id])) ?></li>
  660 + <?php foreach($product->variant->variantStocks as $stock){
  661 + if($stock->quantity > 0 ){?>
  662 + <li><?= Html::a($stock->stock->siteName, Url::to (['text/main', 'translit' => 'magaziny', '#'=>$stock->stock->stock_id])) ?></li>
  663 + <?php } ?>
662 664 <?php } ?>
663 665 </ul>
664 666  
... ...
frontend/views/layouts/main.php
... ... @@ -58,19 +58,18 @@ use common\models\Event;
58 58 ga('send', 'pageview');
59 59  
60 60 </script>
61   -
62 61 <!-- Google Tag Manager -->
63 62 <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
64 63 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
65 64 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
66 65 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
67   - })(window,document,'script','dataLayer','GTM-MWB6PH');</script>
  66 + })(window,document,'script','dataLayer','GTM-NMXP4K');</script>
68 67 <!-- End Google Tag Manager -->
69 68 </head>
70 69 <?php $this->beginBody() ?>
71 70 <body>
72 71 <!-- Google Tag Manager (noscript) -->
73   - <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MWB6PH"
  72 + <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NMXP4K"
74 73 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
75 74 <!-- End Google Tag Manager (noscript) -->
76 75  
... ...