Commit c8ee17e4b148f4079eb350707d3aa19d471342c0

Authored by Administrator
1 parent 11dbe035

big commti

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