Fur coat with very but very very long name
+$143.00
+ +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; +?> +
$143.00
+ +
+ $280
+ $143.00
+
$143.00
+ + +$143.00
+ + +$143.00
+ +
+ $280
+ $143.00
+
$143.00
+ + +$143.00
+ + +$143.00
+ +
+ $280
+ $143.00
+
$143.00
+ + +$143.00
+ + +