diff --git a/frontend/controllers/CategoryController.php b/frontend/controllers/CategoryController.php index 489c93f..2230acb 100755 --- a/frontend/controllers/CategoryController.php +++ b/frontend/controllers/CategoryController.php @@ -41,7 +41,7 @@ $query = $filterHelper->buildQuery() ->innerJoinWith('category', false) ->andWhere([ 'product_to_category.category_id' => $model->id ]) - ->with('images', 'variants', 'lang'); + ->with('image', 'variants', 'lang'); $dataProvider = new ActiveDataProvider( [ 'query' => $query, diff --git a/frontend/controllers/ProductController.php b/frontend/controllers/ProductController.php index 304f625..4b38743 100755 --- a/frontend/controllers/ProductController.php +++ b/frontend/controllers/ProductController.php @@ -63,7 +63,7 @@ * @var Product $model */ $model = Product::findWithFilters() - ->with('lang', 'images') + ->with('lang', 'images', 'image') ->with( [ 'category' => function ($query) { diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 3e39ed9..8803b2c 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -56,17 +56,17 @@ ->where([ 'level' => 0 ]) ->all(); $topItems = Product::find() - ->with('lang', 'images', 'variants') + ->with('lang', 'image', 'variants') ->where('mask & 1 != 0') ->limit(20) ->all(); $newItems = Product::find() - ->with('lang', 'images', 'variants') + ->with('lang', 'image', 'variants') ->where('mask & 2 != 0') ->limit(20) ->all(); $saleItems = Product::find() - ->with('lang', 'images', 'variants') + ->with('lang', 'image', 'variants') ->where('mask & 4 != 0') ->limit(20) ->all(); diff --git a/frontend/views/category/_product_item.php b/frontend/views/category/_product_item.php index 9e9f41a..f9ebb7d 100644 --- a/frontend/views/category/_product_item.php +++ b/frontend/views/category/_product_item.php @@ -1,5 +1,6 @@
images )) { - $image = $product->images[ 0 ]; - } else { - $image = null; - } echo Html::a( Html::img( - $image ? $image->getUrl() : '/img/no-image.png', + ImageHelper::set( + $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png' + ) + ->fillResize(260, 260) + ->render(), [ 'class' => 'img-responsive-image1', ] diff --git a/frontend/views/category/view.php b/frontend/views/category/view.php index f72348b..eea8aad 100755 --- a/frontend/views/category/view.php +++ b/frontend/views/category/view.php @@ -23,320 +23,327 @@ $this->params[ 'breadcrumbs' ][] = $seo->title; ?>
-
+
+ +
+ + + + +
-
- - - - -
- - - - + + + getBrands($model); + if (!empty($brands)) { + ?> +
+

+
+ +
+
+ lang->title, + [ + '/category/view', + 'category' => $model->lang->alias->value, + 'filter' => $filterHelper->buildLink($brand), + ] + ), + [ + 'class' => $filterHelper->has( + $brand->lang->alias->value + ) ? 'radio-but checked' : 'radio-but', + ] + ); + } ?> - +
+
+ +
+ + productOptionGroupCompls as $group) { + ?> + + productOptionGroupExcls as $group) { + ?> + + variantOptionGroupCompls as $group) { + ?> + + variantOptionGroupExcls as $group) { + ?> + +
+ -
+ + + + +
+ + + + + + +
+ + [ + 'class' => 'row products', + ], + 'itemOptions' => [ + 'tag' => false, + ], + 'layout' => '{items}', + 'dataProvider' => $dataProvider, + 'itemView' => function ($model) use ($view) { + /** + * @var Product $model + */ + return $view->render( + '_product_item', + [ + 'product' => $model, + ] + ); + }, + ] + ); + echo Html::tag( + 'div', + LinkPager::widget( + [ + 'pagination' => $dataProvider->pagination, + ] + ), + [ + 'class' => 'pages', + ] + ); + ?> + +
+ + +
- + +
+
diff --git a/frontend/views/product/view.php b/frontend/views/product/view.php index 1189696..3cbd8c1 100755 --- a/frontend/views/product/view.php +++ b/frontend/views/product/view.php @@ -36,6 +36,9 @@ ]; } $this->params[ 'breadcrumbs' ][] = $seo->title; + if (!empty($model->image)) { + array_unshift($model->images, $model->image); + } ?>
diff --git a/frontend/views/site/_slider_product.php b/frontend/views/site/_slider_product.php index 92d10fc..d6c6283 100644 --- a/frontend/views/site/_slider_product.php +++ b/frontend/views/site/_slider_product.php @@ -1,28 +1,25 @@ get('imagemanager'); ?>
images )) { - $image = $product->images[ 0 ]->id; - } else { - $image = null; - } echo Html::a( Html::img( - $image ? $imageManager->getImagePath($image) : '/img/no-image.png', + ImageHelper::set( + $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png' + ) + ->fillResize(260, 260) + ->render(), [ 'class' => 'img-responsive-image1', ] -- libgit2 0.21.4