Commit 26f2d2d07896506e9234019c8ec13e7337cf1c83
1 parent
f27a7bd1
20.07.16
Showing
5 changed files
with
2 additions
and
140 deletions
Show diff stats
common/modules/product/CatalogUrlManager.php
... | ... | @@ -156,7 +156,7 @@ class CatalogUrlManager implements UrlRuleInterface { |
156 | 156 | // $brand_alias = is_object($params['brand']) ? $params['brand']->alias : strtolower($params['brand']); |
157 | 157 | // } |
158 | 158 | // $url = 'brands/'. $brand_alias .'/'; |
159 | - | |
159 | +// | |
160 | 160 | // $this->setFilterUrl($params, $url); |
161 | 161 | // |
162 | 162 | // if (!empty($params) && ($query = http_build_query($params)) !== '') { | ... | ... |
frontend/config/main.php
... | ... | @@ -136,7 +136,7 @@ return [ |
136 | 136 | // 'products/<translit_rubric:\w+>/<translit:[\w\-]+>-<id:\d+>' => 'products/show', |
137 | 137 | 'news/<translit:\w+>-<id:\d+>' => 'news/show', |
138 | 138 | 'brands' => 'catalog/brands', |
139 | - 'brands/<brand:[\w\-]+>' => 'catalog/brand', | |
139 | + 'brands/<brand:[\w\-]+>' => 'catalog/brand', | |
140 | 140 | 'blog' => 'articles/index', |
141 | 141 | 'blog/<translit:[\w\-]+>-<id:\d+>' => 'articles/show', |
142 | 142 | 'event' => 'event/index', | ... | ... |
frontend/controllers/BrendsController.php deleted
1 | -<?php | |
2 | - | |
3 | -namespace frontend\controllers; | |
4 | - | |
5 | -use Yii; | |
6 | -use yii\web\Controller; | |
7 | -use common\models\Brends; | |
8 | -use common\models\Products; | |
9 | -use yii\web\HttpException; | |
10 | -use yii\data\Pagination; | |
11 | - | |
12 | -class BrendsController extends Controller | |
13 | -{ | |
14 | - | |
15 | - public function actionShow() | |
16 | - { | |
17 | - | |
18 | - if(!$brend = Brends::find()->where(['translit'=>$_GET['translit']])->one()) | |
19 | - throw new HttpException(404, 'Данной странице не существует!'); | |
20 | - | |
21 | - $query = Products::find()->where('brend_id=:brend_id',[':brend_id' => $brend->id])->with(['catalog'])->innerJoinWith(['cost']); | |
22 | - $countQuery = clone $query; | |
23 | - $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize'=>18]); | |
24 | - $pages->forcePageParam = false; | |
25 | - $pages->pageSizeParam = false; | |
26 | - $products = $query->offset($pages->offset) | |
27 | - ->limit($pages->limit) | |
28 | - ->all(); | |
29 | - | |
30 | - return $this->render('show', [ | |
31 | - 'brend'=>$brend, | |
32 | - 'products'=>$products, | |
33 | - 'pages'=>$pages, | |
34 | - ]); | |
35 | - } | |
36 | - | |
37 | - public function actionIndex() | |
38 | - { | |
39 | - | |
40 | - $brends = Brends::find()->orderBy('sort ASC')->all(); | |
41 | - | |
42 | - return $this->render('index', [ | |
43 | - 'brends'=>$brends, | |
44 | - ]); | |
45 | - } | |
46 | - | |
47 | -} | |
48 | 0 | \ No newline at end of file |
frontend/views/brends/index.php deleted
1 | -<?php | |
2 | -use yii\helpers\Url; | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\Breadcrumbs; | |
5 | - | |
6 | -$this->title = 'Бренды'; | |
7 | -$this->registerMetaTag(['name' => 'description', 'content' => 'Бренды']); | |
8 | -$this->registerMetaTag(['name' => 'keywords', 'content' => 'Бренды']); | |
9 | - | |
10 | -$this->params['breadcrumbs'][] = ['label'=>'Бренды','url'=>['/brends/index']]; | |
11 | -?> | |
12 | - | |
13 | - <nav class="bread-crumbs"> | |
14 | - <?= Breadcrumbs::widget([ | |
15 | - 'links' => $this->params['breadcrumbs'], | |
16 | - ]) | |
17 | - | |
18 | - ?> | |
19 | - <div class="both"></div> | |
20 | - </nav> | |
21 | - | |
22 | - | |
23 | -<div class="loyout"> | |
24 | - | |
25 | - <h1>Бренды</h1> | |
26 | - | |
27 | - <ul class="brends_list"> | |
28 | - <?foreach($brends as $item):?> | |
29 | - <li> | |
30 | - | |
31 | - <a href="<?=Url::to(['brends/show','translit'=>$item->translit])?>"><img src="<?=Yii::$app->request->baseUrl.'/upload/brends/'.$item->image?>" width="150" height="150" border="0" /></a> | |
32 | - <br /> | |
33 | - <a href="<?=Url::to(['brends/show','translit'=>$item->translit])?>" class="name"><?=$item->name?></a> | |
34 | - | |
35 | - | |
36 | - </li> | |
37 | - <?endforeach;?><div class="both"></div> | |
38 | - </ul> | |
39 | - | |
40 | -</div> |
frontend/views/brends/show.php deleted
1 | -<?php | |
2 | - use yii\helpers\Url; | |
3 | - use yii\helpers\Html; | |
4 | - use yii\widgets\Breadcrumbs; | |
5 | - use yii\widgets\LinkPager; | |
6 | - use yii\web\View; | |
7 | - | |
8 | -// $this->title = $brend->name; | |
9 | - $this->params['seo']['fields']['name'] = $brend->name; | |
10 | - $this->registerMetaTag (['name' => 'description', 'content' => $brend->name]); | |
11 | - $this->registerMetaTag (['name' => 'keywords', 'content' => $brend->name]); | |
12 | - $this->params['breadcrumbs'][] = ['label' => 'Бренды', 'url' => ['/brends/index']]; | |
13 | - $this->params['breadcrumbs'][] = ['label' => $brend->name]; | |
14 | - | |
15 | -?> | |
16 | - | |
17 | -<nav class="bread-crumbs"> | |
18 | - <?= Breadcrumbs::widget ([ | |
19 | - 'links' => $this->params['breadcrumbs'], | |
20 | - ]) | |
21 | - ?> | |
22 | - <div class="both"></div> | |
23 | -</nav> | |
24 | - | |
25 | - | |
26 | -<div class="loyout"> | |
27 | - <div class="content"> | |
28 | - <h1><?= $brend->name ?></h1> | |
29 | - | |
30 | - <div class="products pn"> | |
31 | - | |
32 | - <ul> | |
33 | - | |
34 | - <?php foreach ($products as $item): ?> | |
35 | - <li class="item"> | |
36 | - <?= $this->render ('/products/_product', ['item' => $item, 'num' => 3]) ?> | |
37 | - </li> | |
38 | - <?php endforeach; ?> | |
39 | - | |
40 | - </ul> | |
41 | - <div class="both"></div> | |
42 | - </div> | |
43 | - | |
44 | - <?= LinkPager::widget ([ | |
45 | - 'pagination' => $pages, | |
46 | - 'registerLinkTags' => true, | |
47 | - ]); ?> | |
48 | - | |
49 | - | |
50 | - </div> | |
51 | -</div> | |
52 | 0 | \ No newline at end of file |