diff --git a/frontend/controllers/CategoryController.php b/frontend/controllers/CategoryController.php new file mode 100755 index 0000000..c026b9e --- /dev/null +++ b/frontend/controllers/CategoryController.php @@ -0,0 +1,95 @@ +findModel($id); + /** + * @var SeoComponent $seo + */ + $seo = Yii::$app->get('seo'); + $seo->setModel($model->lang); + $filterHelper = \Yii::$app->get('filter'); + $filterHelper->setFilter($filter); + $query = $filterHelper->buildQuery(); + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + ] + ); + + return $this->render( + 'view', + [ + 'model' => $model, + 'dataProvider' => $dataProvider, + ] + ); + } + + /** + * Find category by ID + * + * @param $id + * + * @return \artbox\core\models\Page + * @throws \yii\web\NotFoundHttpException + */ + protected function findModel($id) + { + /** + * @var SeoComponent $seo + */ + $seo = Yii::$app->get('seo'); + /** + * @var Page $model + */ + $model = Category::findWithFilters($id) + ->with('lang') + ->with('categories.lang') + ->with( + [ + 'parent' => function ($query) { + /** + * @var ActiveQuery $query + */ + $query->with('lang', 'categories.lang'); + }, + ] + ) + ->one(); + if (!empty( $model )) { + if ($model->lang->alias_id !== $seo->aliasId) { + throw new NotFoundHttpException('Wrong language'); + } + return $model; + } else { + throw new NotFoundHttpException('Model not found'); + } + } + } \ No newline at end of file diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 4d82dc5..3e39ed9 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -74,6 +74,18 @@ ->count(); $brandCount = Brand::find() ->count(); + $brands = Brand::find() + ->where([ 'status' => true ]) + ->andWhere( + [ + 'not', + [ 'image_id' => null ], + ] + ) + ->orderBy([ 'sort' => SORT_ASC ]) + ->limit(6) + ->with('image') + ->all(); return $this->render( 'index', [ @@ -83,6 +95,7 @@ 'saleItems' => $saleItems, 'productCount' => $productCount, 'brandCount' => $brandCount, + 'brands' => $brands, ] ); } diff --git a/frontend/views/category/view.php b/frontend/views/category/view.php new file mode 100755 index 0000000..c61220c --- /dev/null +++ b/frontend/views/category/view.php @@ -0,0 +1,743 @@ +get('seo'); + $filterHelper = \Yii::$app->get('filter'); + $this->params[ 'breadcrumbs' ][] = $seo->title; +?> +
+
+ +
+ + + + +
+ + + + + + productOptionGroupCompls as $group) { + ?> + + productOptionGroupExcls as $group) { + ?> + + variantOptionGroupCompls as $group) { + ?> + + variantOptionGroupExcls as $group) { + ?> + + + + + + + +
+ + + + + + +
+ +
+ + + +
+
+
+ + + +
+ +
+

White Blouse Armani

+

+ $280 + $143.00 +

+

+ В корзину +

+
+ + +
+
Скидки
+
+
+ + +
+
Новое
+
+
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Black Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Black Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ +
+
+
+ + + +
+ +
+

White Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ + + +
+
Новое
+
+
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Fur coat

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ + + +
+
+
+ + + +
+ +
+

White Blouse Armani

+

+ $280 + $143.00 +

+

+ В корзину +

+
+ + +
+
Скидки
+
+
+ + +
+
Новое
+
+
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Black Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Black Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ +
+
+
+ + + +
+ +
+

White Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ + + +
+
Новое
+
+
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Fur coat

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ + + +
+
+
+ + + +
+ +
+

White Blouse Armani

+

+ $280 + $143.00 +

+

+ В корзину +

+
+ + +
+
Скидки
+
+
+ + +
+
Новое
+
+
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Black Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Black Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ +
+
+
+ + + +
+ +
+

White Blouse Versace

+

$143.00

+

+ В корзину +

+ +
+ + + +
+
Новое
+
+
+ +
+ +
+ +
+
+
+ + + +
+ +
+

Fur coat

+

$143.00

+

+ В корзину +

+ +
+ +
+ +
+ +
+ + +
+ +
    +
  • « +
  • +
  • 1 +
  • +
  • 2 +
  • +
  • 3 +
  • +
  • 4 +
  • +
  • 5 +
  • +
  • » +
  • +
+
+ + +
+ + + + +
+ +
+ +
+ diff --git a/frontend/views/layouts/_category_menu.php b/frontend/views/layouts/_category_menu.php new file mode 100644 index 0000000..2303c2e --- /dev/null +++ b/frontend/views/layouts/_category_menu.php @@ -0,0 +1,54 @@ +with('categories.lang', 'lang') + ->where([ 'level' => 0 ]) + ->all(); +?> + diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 551ae2c..c936eb8 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -182,10 +182,20 @@