Commit 076b9c962b3be49609474434917b6b1a0a009f75
1 parent
fceda630
big commti
Showing
15 changed files
with
52 additions
and
48 deletions
Show diff stats
frontend/config/main.php
@@ -53,11 +53,11 @@ return [ | @@ -53,11 +53,11 @@ return [ | ||
53 | 'enablePrettyUrl' => true, | 53 | 'enablePrettyUrl' => true, |
54 | 'showScriptName' => false, | 54 | 'showScriptName' => false, |
55 | 'rules' => [ | 55 | 'rules' => [ |
56 | - '' => 'site/index', | ||
57 | - 'login' => 'login/index', | ||
58 | - 'iam' => 'iam/index', | ||
59 | - 'text/<translit:[\w\_\-]+>' => 'text/index', | ||
60 | - '<language:(ru|ua|en)>/text/<translit:\w+>' => 'text/index', | 56 | + '' => 'site/main', |
57 | + 'login' => 'login/main', | ||
58 | + 'iam' => 'iam/main', | ||
59 | + 'text/<translit:[\w\_\-]+>' => 'text/main', | ||
60 | + '<language:(ru|ua|en)>/text/<translit:\w+>' => 'text/main', | ||
61 | [ | 61 | [ |
62 | 'class' => '\common\modules\product\CatalogUrlManager', | 62 | 'class' => '\common\modules\product\CatalogUrlManager', |
63 | 'route_map' => [ | 63 | 'route_map' => [ |
@@ -68,16 +68,17 @@ return [ | @@ -68,16 +68,17 @@ return [ | ||
68 | 68 | ||
69 | ] | 69 | ] |
70 | ], | 70 | ], |
71 | + 'cabinet/main' => '/cabinet/main', | ||
71 | 'priceparam.xml' => 'site/priceparam', | 72 | 'priceparam.xml' => 'site/priceparam', |
72 | 'price.xml' => 'site/price', | 73 | 'price.xml' => 'site/price', |
73 | 'smstest' => 'site/sms', | 74 | 'smstest' => 'site/sms', |
74 | - 'search' => 'search/index', | 75 | + 'search/main' => 'search/main', |
75 | 'news/<translit:\w+>-<id:\d+>' => 'news/show', | 76 | 'news/<translit:\w+>-<id:\d+>' => 'news/show', |
76 | - 'brands' => 'catalog/brands', | 77 | + 'brands/main' => 'catalog/brands', |
77 | 'brands/<brand:[\w\-]+>' => 'catalog/brand', | 78 | 'brands/<brand:[\w\-]+>' => 'catalog/brand', |
78 | - 'articles' => 'articles/index', | ||
79 | - 'articles/<translit:[\w\-]+>-<id:\d+>' => 'articles/show', | ||
80 | - 'event' => 'event/index', | 79 | + 'articles/main' => 'articles/main', |
80 | + 'articles/<translit:[\w\-\_]+>' => 'articles/show', | ||
81 | + 'event/main' => 'event/main', | ||
81 | 'event/sale/<percent:[\d\-]+>' => 'event/sale', | 82 | 'event/sale/<percent:[\d\-]+>' => 'event/sale', |
82 | 'event/<alias:[\w\-]+>' => 'event/show', | 83 | 'event/<alias:[\w\-]+>' => 'event/show', |
83 | ], | 84 | ], |
frontend/controllers/ArticlesController.php
@@ -11,7 +11,7 @@ use yii\data\Pagination; | @@ -11,7 +11,7 @@ use yii\data\Pagination; | ||
11 | class ArticlesController extends Controller | 11 | class ArticlesController extends Controller |
12 | { | 12 | { |
13 | 13 | ||
14 | - public function actionIndex() | 14 | + public function actionMain() |
15 | { | 15 | { |
16 | 16 | ||
17 | $query = Articles::find()->groupBy('id')->orderBy('id DESC') ; | 17 | $query = Articles::find()->groupBy('id')->orderBy('id DESC') ; |
@@ -29,14 +29,21 @@ class ArticlesController extends Controller | @@ -29,14 +29,21 @@ class ArticlesController extends Controller | ||
29 | 'news'=>$news, | 29 | 'news'=>$news, |
30 | ]); | 30 | ]); |
31 | } | 31 | } |
32 | - | ||
33 | - public function actionShow(){ | ||
34 | - if(!$news = Articles::find()->where(['id'=>$_GET['id']])->one()) | ||
35 | - throw new HttpException(404, 'Данной странице не существует!'); | ||
36 | - | ||
37 | - return $this->render('show', [ | ||
38 | - 'news'=>$news, | ||
39 | - ]); | 32 | + public function actionShow($translit){ |
33 | + $news = $this->findModel($translit); | ||
34 | + | ||
35 | + | ||
36 | + return $this->render('show', [ | ||
37 | + 'news'=>$news, | ||
38 | + ]); | ||
39 | + } | ||
40 | + protected function findModel($translit) | ||
41 | + { | ||
42 | + if (($model = Articles::findOne(["translit"=>$translit])) !== null) { | ||
43 | + return $model; | ||
44 | + } else { | ||
45 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
46 | + } | ||
40 | } | 47 | } |
41 | 48 | ||
42 | } | 49 | } |
43 | \ No newline at end of file | 50 | \ No newline at end of file |
frontend/controllers/BasketController.php
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | 10 | ||
11 | public $enableCsrfValidation = false; | 11 | public $enableCsrfValidation = false; |
12 | 12 | ||
13 | - public function actionIndex() | 13 | + public function actionMain() |
14 | { | 14 | { |
15 | $response = \Yii::$app->response; | 15 | $response = \Yii::$app->response; |
16 | $response->format = Response::FORMAT_JSON; | 16 | $response->format = Response::FORMAT_JSON; |
frontend/controllers/CabinetController.php
@@ -40,7 +40,7 @@ class CabinetController extends Controller | @@ -40,7 +40,7 @@ class CabinetController extends Controller | ||
40 | 'allow' => true, | 40 | 'allow' => true, |
41 | ], | 41 | ], |
42 | [ | 42 | [ |
43 | - 'actions' => ['logout', 'index', 'create', 'update', 'view', 'delete','my-orders','bookmarks'], | 43 | + 'actions' => ['logout', 'main', 'create', 'update', 'view', 'delete','my-orders','bookmarks'], |
44 | 'allow' => true, | 44 | 'allow' => true, |
45 | 'roles' => ['@'], | 45 | 'roles' => ['@'], |
46 | ], | 46 | ], |
@@ -55,7 +55,7 @@ class CabinetController extends Controller | @@ -55,7 +55,7 @@ class CabinetController extends Controller | ||
55 | ]; | 55 | ]; |
56 | } | 56 | } |
57 | 57 | ||
58 | - public function actionIndex(){ | 58 | + public function actionMain(){ |
59 | return $this->render('index'); | 59 | return $this->render('index'); |
60 | } | 60 | } |
61 | 61 |
frontend/controllers/EventController.php
@@ -13,7 +13,7 @@ use yii\data\ActiveDataProvider; | @@ -13,7 +13,7 @@ use yii\data\ActiveDataProvider; | ||
13 | class EventController extends Controller | 13 | class EventController extends Controller |
14 | { | 14 | { |
15 | 15 | ||
16 | - public function actionIndex() | 16 | + public function actionMain() |
17 | { | 17 | { |
18 | 18 | ||
19 | $dataProvider = new ActiveDataProvider([ | 19 | $dataProvider = new ActiveDataProvider([ |
frontend/controllers/OrderController.php
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | class OrderController extends Controller | 17 | class OrderController extends Controller |
18 | { | 18 | { |
19 | 19 | ||
20 | - public function actionIndex() | 20 | + public function actionMain() |
21 | { | 21 | { |
22 | $basket = \Yii::$app->basket; | 22 | $basket = \Yii::$app->basket; |
23 | $data = $basket->getData(); | 23 | $data = $basket->getData(); |
frontend/controllers/SearchController.php
@@ -11,7 +11,7 @@ use yii\web\HttpException; | @@ -11,7 +11,7 @@ use yii\web\HttpException; | ||
11 | 11 | ||
12 | class SearchController extends \yii\web\Controller | 12 | class SearchController extends \yii\web\Controller |
13 | { | 13 | { |
14 | - public function actionIndex() | 14 | + public function actionMain() |
15 | { | 15 | { |
16 | 16 | ||
17 | $word = trim(Yii::$app->request->get('word', '')); | 17 | $word = trim(Yii::$app->request->get('word', '')); |
frontend/controllers/SiteController.php
frontend/controllers/TextController.php
@@ -10,7 +10,7 @@ use yii\web\HttpException; | @@ -10,7 +10,7 @@ use yii\web\HttpException; | ||
10 | class TextController extends Controller | 10 | class TextController extends Controller |
11 | { | 11 | { |
12 | 12 | ||
13 | - public function actionIndex() | 13 | + public function actionMain() |
14 | { | 14 | { |
15 | 15 | ||
16 | if(!$modelText = Page::find()->where(['translit'=>$_GET['translit']])->one()) | 16 | if(!$modelText = Page::find()->where(['translit'=>$_GET['translit']])->one()) |
frontend/views/articles/index.php
@@ -35,14 +35,12 @@ | @@ -35,14 +35,12 @@ | ||
35 | <a href="<?= Url::to([ | 35 | <a href="<?= Url::to([ |
36 | 'articles/show', | 36 | 'articles/show', |
37 | 'translit' => $item->translit, | 37 | 'translit' => $item->translit, |
38 | - 'id' => $item->id, | ||
39 | ]) ?>"> | 38 | ]) ?>"> |
40 | <?= Html::img(\common\components\artboximage\ArtboxImageHelper::getImageSrc($item->imageUrl, 'list'), [ 'class' => 'float-left' ]) ?> | 39 | <?= Html::img(\common\components\artboximage\ArtboxImageHelper::getImageSrc($item->imageUrl, 'list'), [ 'class' => 'float-left' ]) ?> |
41 | </a> | 40 | </a> |
42 | <a href="<?= Url::to([ | 41 | <a href="<?= Url::to([ |
43 | 'articles/show', | 42 | 'articles/show', |
44 | 'translit' => $item->translit, | 43 | 'translit' => $item->translit, |
45 | - 'id' => $item->id, | ||
46 | ]) ?>" class="name"><?= $item->title ?></a><br/> | 44 | ]) ?>" class="name"><?= $item->title ?></a><br/> |
47 | <div class="comment_display_block article_list_comment"> | 45 | <div class="comment_display_block article_list_comment"> |
48 | <?php | 46 | <?php |
@@ -58,7 +56,6 @@ | @@ -58,7 +56,6 @@ | ||
58 | echo Html::a(( $comment_count ? 'Отзывов: ' . count($item->comments) : "Оставить отзыв" ), [ | 56 | echo Html::a(( $comment_count ? 'Отзывов: ' . count($item->comments) : "Оставить отзыв" ), [ |
59 | 'articles/show', | 57 | 'articles/show', |
60 | 'translit' => $item->translit, | 58 | 'translit' => $item->translit, |
61 | - 'id' => $item->id, | ||
62 | '#' => 'artbox-comment', | 59 | '#' => 'artbox-comment', |
63 | ]); | 60 | ]); |
64 | ?> | 61 | ?> |
frontend/views/catalog/product.php
@@ -647,7 +647,7 @@ FlipclockAsset::register($this); | @@ -647,7 +647,7 @@ FlipclockAsset::register($this); | ||
647 | <div class="shopsList"> | 647 | <div class="shopsList"> |
648 | <ul> | 648 | <ul> |
649 | <?php foreach($product->variant->stocks as $stock){?> | 649 | <?php foreach($product->variant->stocks as $stock){?> |
650 | - <li><?= Html::a($stock->siteName, Url::to (['text/index', 'translit' => 'magaziny', '#'=>$stock->stock_id])) ?></li> | 650 | + <li><?= Html::a($stock->siteName, Url::to (['text/main', 'translit' => 'magaziny', '#'=>$stock->stock_id])) ?></li> |
651 | <?php } ?> | 651 | <?php } ?> |
652 | </ul> | 652 | </ul> |
653 | 653 |
frontend/views/layouts/cabinet.php
@@ -11,7 +11,7 @@ $this->beginContent('@app/views/layouts/main.php'); | @@ -11,7 +11,7 @@ $this->beginContent('@app/views/layouts/main.php'); | ||
11 | <div class="cabinet_wrap"> | 11 | <div class="cabinet_wrap"> |
12 | <div class="cabinet_menu"> | 12 | <div class="cabinet_menu"> |
13 | <div class="block_01"> | 13 | <div class="block_01"> |
14 | - <div class="cab_01"><?= Html::a(Yii::t('app','personal_data'), Url::toRoute('cabinet/index'))?></div> | 14 | + <div class="cab_01"><?= Html::a(Yii::t('app','personal_data'), Url::toRoute('cabinet/main'))?></div> |
15 | <div class="cab_01"><?= Html::a(Yii::t('app','my_orders'), Url::toRoute('cabinet/my-orders'))?></div> | 15 | <div class="cab_01"><?= Html::a(Yii::t('app','my_orders'), Url::toRoute('cabinet/my-orders'))?></div> |
16 | <div class="cab_01"><?= Html::a(Yii::t('app','bookmarks'), Url::toRoute('cabinet/bookmarks'))?></div> | 16 | <div class="cab_01"><?= Html::a(Yii::t('app','bookmarks'), Url::toRoute('cabinet/bookmarks'))?></div> |
17 | </div> | 17 | </div> |
frontend/views/layouts/main-menu.php
@@ -69,13 +69,13 @@ $models = Category::find()->all(); | @@ -69,13 +69,13 @@ $models = Category::find()->all(); | ||
69 | 69 | ||
70 | <li> | 70 | <li> |
71 | <?php | 71 | <?php |
72 | - echo Html::a('Дисконтная программа', Url::to (['text/index', 'translit' => 'diskontnaya-programma'])) | 72 | + echo Html::a('Дисконтная программа', Url::to (['text/main', 'translit' => 'diskontnaya-programma'])) |
73 | ?> | 73 | ?> |
74 | </li> | 74 | </li> |
75 | 75 | ||
76 | <li> | 76 | <li> |
77 | <?php | 77 | <?php |
78 | - echo Html::a('Статьи', Url::to('/articles/index')) | 78 | + echo Html::a('Статьи', Url::to('/articles/main')) |
79 | ?> | 79 | ?> |
80 | </li> | 80 | </li> |
81 | 81 |
frontend/views/layouts/main.php
@@ -92,10 +92,10 @@ use common\models\Event; | @@ -92,10 +92,10 @@ use common\models\Event; | ||
92 | </ul> | 92 | </ul> |
93 | </div> | 93 | </div> |
94 | </li> | 94 | </li> |
95 | - <li><?php echo Html::a('Магазины',Url::to (['text/index', 'translit' => 'magaziny'])) ?></li> | ||
96 | - <li><?php echo Html::a('Гарантии', Url::to (['text/index', 'translit' => 'garantii'])) ?></li> | ||
97 | - <li><?php echo Html::a('Оплата', Url::to (['text/index', 'translit' => 'oplata'])) ?></li> | ||
98 | - <li><?php echo Html::a('Доставка', Url::to (['text/index', 'translit' => 'dostavka-tovarov'])) ?></li> | 95 | + <li><?php echo Html::a('Магазины',Url::to (['text/main', 'translit' => 'magaziny'])) ?></li> |
96 | + <li><?php echo Html::a('Гарантии', Url::to (['text/main', 'translit' => 'garantii'])) ?></li> | ||
97 | + <li><?php echo Html::a('Оплата', Url::to (['text/main', 'translit' => 'oplata'])) ?></li> | ||
98 | + <li><?php echo Html::a('Доставка', Url::to (['text/main', 'translit' => 'dostavka-tovarov'])) ?></li> | ||
99 | </ul> | 99 | </ul> |
100 | </div> | 100 | </div> |
101 | <div class="col-md-3 col-lg-2"> | 101 | <div class="col-md-3 col-lg-2"> |
@@ -107,7 +107,7 @@ use common\models\Event; | @@ -107,7 +107,7 @@ use common\models\Event; | ||
107 | 'class' => 'cabinet_link_', | 107 | 'class' => 'cabinet_link_', |
108 | ]); | 108 | ]); |
109 | } else { | 109 | } else { |
110 | - echo Html::a('<span>' . Yii::$app->user->identity->username . '</span>', Url::toRoute([ 'cabinet/index' ]), [ 'class' => 'cabinet_link_' ]); | 110 | + echo Html::a('<span>' . Yii::$app->user->identity->username . '</span>', Url::toRoute([ 'cabinet/main' ]), [ 'class' => 'cabinet_link_' ]); |
111 | } | 111 | } |
112 | ?> | 112 | ?> |
113 | </div> | 113 | </div> |
@@ -255,8 +255,7 @@ use common\models\Event; | @@ -255,8 +255,7 @@ use common\models\Event; | ||
255 | <li> | 255 | <li> |
256 | <?= Html::a($article->title, Url::to([ | 256 | <?= Html::a($article->title, Url::to([ |
257 | 'articles/show', | 257 | 'articles/show', |
258 | - 'translit' => $article->translit, | ||
259 | - 'id' => $article->id, | 258 | + 'translit' => $article->translit |
260 | ]))?> | 259 | ]))?> |
261 | </li> | 260 | </li> |
262 | <?php endforeach;?> | 261 | <?php endforeach;?> |
@@ -394,12 +393,12 @@ use common\models\Event; | @@ -394,12 +393,12 @@ use common\models\Event; | ||
394 | </div> | 393 | </div> |
395 | <div class="row"> | 394 | <div class="row"> |
396 | <ul class="copy first_list_copy col-md-12"> | 395 | <ul class="copy first_list_copy col-md-12"> |
397 | - <li><?php echo Html::a('Магазины',Url::to (['text/index', 'translit' => 'magaziny'])) ?></li> | ||
398 | - <li><?php echo Html::a('Гарантии', Url::to (['text/index', 'translit' => 'garantii'])) ?></li> | ||
399 | - <li><?php echo Html::a('Оплата', Url::to (['text/index', 'translit' => 'oplata'])) ?></li> | ||
400 | - <li><?php echo Html::a('Доставка', Url::to (['text/index', 'translit' => 'dostavka-tovarov'])) ?></li> | ||
401 | - <li><?php echo Html::a('Дисконтная программа', Url::to (['text/index', 'translit' => 'diskontnaya-programma'])) ?></li> | ||
402 | - <li><?php echo Html::a('О проекте', Url::to (['text/index', 'translit' => 'o-proekte'])) ?></li> | 396 | + <li><?php echo Html::a('Магазины',Url::to (['text/main', 'translit' => 'magaziny'])) ?></li> |
397 | + <li><?php echo Html::a('Гарантии', Url::to (['text/main', 'translit' => 'garantii'])) ?></li> | ||
398 | + <li><?php echo Html::a('Оплата', Url::to (['text/main', 'translit' => 'oplata'])) ?></li> | ||
399 | + <li><?php echo Html::a('Доставка', Url::to (['text/main', 'translit' => 'dostavka-tovarov'])) ?></li> | ||
400 | + <li><?php echo Html::a('Дисконтная программа', Url::to (['text/main', 'translit' => 'diskontnaya-programma'])) ?></li> | ||
401 | + <li><?php echo Html::a('О проекте', Url::to (['text/main', 'translit' => 'o-proekte'])) ?></li> | ||
403 | </ul> | 402 | </ul> |
404 | </div> | 403 | </div> |
405 | </div> | 404 | </div> |
frontend/views/partial/main-menu.php