diff --git a/common/modules/product/CatalogUrlManager.php b/common/modules/product/CatalogUrlManager.php index 5b835b2..5733d35 100755 --- a/common/modules/product/CatalogUrlManager.php +++ b/common/modules/product/CatalogUrlManager.php @@ -46,7 +46,7 @@ class CatalogUrlManager implements UrlRuleInterface { $link = 'product'.'/'. $product_variant->product->alias; header("Status: 301"); - header("Location: http://www.test-22.artweb.com.ua/".$link); + header("Location: http://www.linija-svitla.ua/".$link); die(); } } @@ -60,7 +60,7 @@ class CatalogUrlManager implements UrlRuleInterface { $link = 'product'.'/'. $product_variant->product->alias; header("Status: 301"); - header("Location: http://www.test-22.artweb.com.ua/".$link); + header("Location: http://www.linija-svitla.ua/".$link); die(); } } @@ -73,7 +73,7 @@ class CatalogUrlManager implements UrlRuleInterface { $link = 'product'.'/'. $product_variant->product->alias; header("Status: 301"); - header("Location: http://www.test-22.artweb.com.ua/".$link); + header("Location: http://www.linija-svitla.ua/".$link); die(); } $sku = $old_item_name[$count-2].'/'.$old_item_name[$count-1].' '.$old_item_name[$count]; @@ -82,7 +82,7 @@ class CatalogUrlManager implements UrlRuleInterface { if($product_variant instanceof ProductVariant){ $link = 'product'.'/'. $product_variant->product->alias; header("Status: 301"); - header("Location: http://www.test-22.artweb.com.ua/".$link); + header("Location: http://www.linija-svitla.ua/".$link); die(); } @@ -92,7 +92,7 @@ class CatalogUrlManager implements UrlRuleInterface { if($product_variant instanceof ProductVariant){ $link = 'product'.'/'. $product_variant->product->alias; header("Status: 301"); - header("Location: http://www.test-22.artweb.com.ua/".$link); + header("Location: http://www.linija-svitla.ua/".$link); die(); } @@ -102,7 +102,7 @@ class CatalogUrlManager implements UrlRuleInterface { if($product_variant instanceof ProductVariant){ $link = 'product'.'/'. $product_variant->product->alias; header("Status: 301"); - header("Location: http://www.test-22.artweb.com.ua/".$link); + header("Location: http://www.linija-svitla.ua/".$link); die(); } @@ -115,7 +115,7 @@ class CatalogUrlManager implements UrlRuleInterface { $link = 'product'.'/'. $product_variant->product->alias; header("Status: 301"); - header("Location: http://www.test-22.artweb.com.ua/".$link); + header("Location: http://www.linija-svitla.ua/".$link); die(); } } @@ -127,7 +127,7 @@ class CatalogUrlManager implements UrlRuleInterface { $link = 'product'.'/'. $product_variant->product->alias; header("Status: 301"); - header("Location: http://www.test-22.artweb.com.ua/".$link); + header("Location: http://www.linija-svitla.ua/".$link); die(); } } diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php index b314863..9cff907 100755 --- a/common/modules/product/models/Category.php +++ b/common/modules/product/models/Category.php @@ -241,7 +241,7 @@ class Category extends \yii\db\ActiveRecord ->innerJoin('tax_group','tax_group.tax_group_id = tax_option.tax_group_id') ->orderBy('tax_option.sort, tax_group.sort'); return $query3->all(); - }, 3600*24); + }, 3600); } diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php index f299495..9cb5b89 100755 --- a/common/modules/product/models/Product.php +++ b/common/modules/product/models/Product.php @@ -153,7 +153,8 @@ class Product extends \yii\db\ActiveRecord */ public function getImageUrl() { - $image = empty($this->variant) ? null : $this->variant->image; + + $image = !empty($this->image) ? $this->image : $this->variant->image; return !empty($image) ? $image->imageUrl : '/storage/no_photo.png'; } diff --git a/common/modules/product/models/ProductVariant.php b/common/modules/product/models/ProductVariant.php index e60c77b..4090e14 100755 --- a/common/modules/product/models/ProductVariant.php +++ b/common/modules/product/models/ProductVariant.php @@ -137,10 +137,6 @@ class ProductVariant extends \yii\db\ActiveRecord return $this->hasMany(ProductStock::className(),['product_variant_id'=> 'product_variant_id'])->joinWith('stock'); } - public function getVariantActiveStocks(){ - - return $this->hasMany(ProductStock::className(),['product_variant_id'=> 'product_variant_id'])->where(['quantity' > 0])->joinWith('stock'); - } public function getStocks(){ diff --git a/common/modules/product/models/Stock.php b/common/modules/product/models/Stock.php index b66c505..4986388 100755 --- a/common/modules/product/models/Stock.php +++ b/common/modules/product/models/Stock.php @@ -68,7 +68,6 @@ class Stock extends \yii\db\ActiveRecord 'name' => Yii::t('product', 'Name'), ]; } - /** * @inheritdoc * @return StockQuery the active query used by this AR class. diff --git a/common/widgets/views/order.php b/common/widgets/views/order.php index 98dd125..13b2370 100755 --- a/common/widgets/views/order.php +++ b/common/widgets/views/order.php @@ -107,7 +107,7 @@
-
+
diff --git a/frontend/models/ProductFrontendSearch.php b/frontend/models/ProductFrontendSearch.php index 3231f8a..829c220 100755 --- a/frontend/models/ProductFrontendSearch.php +++ b/frontend/models/ProductFrontendSearch.php @@ -49,6 +49,7 @@ class ProductFrontendSearch extends Product { */ public function search($category = null, $params = [], $in_stock = true) { + $dataProvider = new ArrayDataProvider([ 'allModels' => $this->getSearchQuery($category, $params, $in_stock)->with([ 'images', @@ -89,13 +90,16 @@ class ProductFrontendSearch extends Product { } public function getSearchQuery($category = null, $params = [], $in_stock = true) { + if (!empty($category)) { /** @var ActiveQuery $query */ /**@var Category $category **/ $query = $category->getProducts(); + } else { $query = Product::find(); } + $query->select(['product.*']); $query->joinWith(['enabledVariants','brand','options', 'category']); diff --git a/frontend/views/catalog/_product_item.php b/frontend/views/catalog/_product_item.php index 590be8c..2a94c79 100755 --- a/frontend/views/catalog/_product_item.php +++ b/frontend/views/catalog/_product_item.php @@ -34,8 +34,7 @@ use yii\helpers\Url; ?> - - variant->imageUrl, 'list', [ + imageUrl, 'list', [ 'alt' => $model->category->name . ' ' . $model->name, 'title' => $model->category->name . ' ' . $model->name, 'class' => 'selected' diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php index e953918..d8b10af 100755 --- a/frontend/views/catalog/product.php +++ b/frontend/views/catalog/product.php @@ -657,8 +657,10 @@
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 8cd3b08..2fbbafa 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -58,19 +58,18 @@ use common\models\Event; ga('send', 'pageview'); - + })(window,document,'script','dataLayer','GTM-NMXP4K'); beginBody() ?> - -- libgit2 0.21.4