Commit 076b9c962b3be49609474434917b6b1a0a009f75

Authored by Administrator
1 parent fceda630

big commti

frontend/config/main.php
... ... @@ -53,11 +53,11 @@ return [
53 53 'enablePrettyUrl' => true,
54 54 'showScriptName' => false,
55 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 62 'class' => '\common\modules\product\CatalogUrlManager',
63 63 'route_map' => [
... ... @@ -68,16 +68,17 @@ return [
68 68  
69 69 ]
70 70 ],
  71 + 'cabinet/main' => '/cabinet/main',
71 72 'priceparam.xml' => 'site/priceparam',
72 73 'price.xml' => 'site/price',
73 74 'smstest' => 'site/sms',
74   - 'search' => 'search/index',
  75 + 'search/main' => 'search/main',
75 76 'news/<translit:\w+>-<id:\d+>' => 'news/show',
76   - 'brands' => 'catalog/brands',
  77 + 'brands/main' => 'catalog/brands',
77 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 82 'event/sale/<percent:[\d\-]+>' => 'event/sale',
82 83 'event/<alias:[\w\-]+>' => 'event/show',
83 84 ],
... ...
frontend/controllers/ArticlesController.php
... ... @@ -11,7 +11,7 @@ use yii\data\Pagination;
11 11 class ArticlesController extends Controller
12 12 {
13 13  
14   - public function actionIndex()
  14 + public function actionMain()
15 15 {
16 16  
17 17 $query = Articles::find()->groupBy('id')->orderBy('id DESC') ;
... ... @@ -29,14 +29,21 @@ class ArticlesController extends Controller
29 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 50 \ No newline at end of file
... ...
frontend/controllers/BasketController.php
... ... @@ -10,7 +10,7 @@
10 10  
11 11 public $enableCsrfValidation = false;
12 12  
13   - public function actionIndex()
  13 + public function actionMain()
14 14 {
15 15 $response = \Yii::$app->response;
16 16 $response->format = Response::FORMAT_JSON;
... ...
frontend/controllers/CabinetController.php
... ... @@ -40,7 +40,7 @@ class CabinetController extends Controller
40 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 44 'allow' => true,
45 45 'roles' => ['@'],
46 46 ],
... ... @@ -55,7 +55,7 @@ class CabinetController extends Controller
55 55 ];
56 56 }
57 57  
58   - public function actionIndex(){
  58 + public function actionMain(){
59 59 return $this->render('index');
60 60 }
61 61  
... ...
frontend/controllers/EventController.php
... ... @@ -13,7 +13,7 @@ use yii\data\ActiveDataProvider;
13 13 class EventController extends Controller
14 14 {
15 15  
16   - public function actionIndex()
  16 + public function actionMain()
17 17 {
18 18  
19 19 $dataProvider = new ActiveDataProvider([
... ...
frontend/controllers/OrderController.php
... ... @@ -17,7 +17,7 @@
17 17 class OrderController extends Controller
18 18 {
19 19  
20   - public function actionIndex()
  20 + public function actionMain()
21 21 {
22 22 $basket = \Yii::$app->basket;
23 23 $data = $basket->getData();
... ...
frontend/controllers/SearchController.php
... ... @@ -11,7 +11,7 @@ use yii\web\HttpException;
11 11  
12 12 class SearchController extends \yii\web\Controller
13 13 {
14   - public function actionIndex()
  14 + public function actionMain()
15 15 {
16 16  
17 17 $word = trim(Yii::$app->request->get('word', ''));
... ...
frontend/controllers/SiteController.php
... ... @@ -20,7 +20,7 @@ class SiteController extends Controller
20 20 {
21 21  
22 22  
23   - public function actionIndex()
  23 + public function actionMain()
24 24 {
25 25  
26 26  
... ...
frontend/controllers/TextController.php
... ... @@ -10,7 +10,7 @@ use yii\web\HttpException;
10 10 class TextController extends Controller
11 11 {
12 12  
13   - public function actionIndex()
  13 + public function actionMain()
14 14 {
15 15  
16 16 if(!$modelText = Page::find()->where(['translit'=>$_GET['translit']])->one())
... ...
frontend/views/articles/index.php
... ... @@ -35,14 +35,12 @@
35 35 <a href="<?= Url::to([
36 36 'articles/show',
37 37 'translit' => $item->translit,
38   - 'id' => $item->id,
39 38 ]) ?>">
40 39 <?= Html::img(\common\components\artboximage\ArtboxImageHelper::getImageSrc($item->imageUrl, 'list'), [ 'class' => 'float-left' ]) ?>
41 40 </a>
42 41 <a href="<?= Url::to([
43 42 'articles/show',
44 43 'translit' => $item->translit,
45   - 'id' => $item->id,
46 44 ]) ?>" class="name"><?= $item->title ?></a><br/>
47 45 <div class="comment_display_block article_list_comment">
48 46 <?php
... ... @@ -58,7 +56,6 @@
58 56 echo Html::a(( $comment_count ? 'Отзывов: ' . count($item->comments) : "Оставить отзыв" ), [
59 57 'articles/show',
60 58 'translit' => $item->translit,
61   - 'id' => $item->id,
62 59 '#' => 'artbox-comment',
63 60 ]);
64 61 ?>
... ...
frontend/views/catalog/product.php
... ... @@ -647,7 +647,7 @@ FlipclockAsset::register($this);
647 647 <div class="shopsList">
648 648 <ul>
649 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 651 <?php } ?>
652 652 </ul>
653 653  
... ...
frontend/views/layouts/cabinet.php
... ... @@ -11,7 +11,7 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
11 11 <div class="cabinet_wrap">
12 12 <div class="cabinet_menu">
13 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 15 <div class="cab_01"><?= Html::a(Yii::t('app','my_orders'), Url::toRoute('cabinet/my-orders'))?></div>
16 16 <div class="cab_01"><?= Html::a(Yii::t('app','bookmarks'), Url::toRoute('cabinet/bookmarks'))?></div>
17 17 </div>
... ...
frontend/views/layouts/main-menu.php
... ... @@ -69,13 +69,13 @@ $models = Category::find()-&gt;all();
69 69  
70 70 <li>
71 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 74 </li>
75 75  
76 76 <li>
77 77 <?php
78   - echo Html::a('Статьи', Url::to('/articles/index'))
  78 + echo Html::a('Статьи', Url::to('/articles/main'))
79 79 ?>
80 80 </li>
81 81  
... ...
frontend/views/layouts/main.php
... ... @@ -92,10 +92,10 @@ use common\models\Event;
92 92 </ul>
93 93 </div>
94 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 99 </ul>
100 100 </div>
101 101 <div class="col-md-3 col-lg-2">
... ... @@ -107,7 +107,7 @@ use common\models\Event;
107 107 'class' => 'cabinet_link_',
108 108 ]);
109 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 113 </div>
... ... @@ -255,8 +255,7 @@ use common\models\Event;
255 255 <li>
256 256 <?= Html::a($article->title, Url::to([
257 257 'articles/show',
258   - 'translit' => $article->translit,
259   - 'id' => $article->id,
  258 + 'translit' => $article->translit
260 259 ]))?>
261 260 </li>
262 261 <?php endforeach;?>
... ... @@ -394,12 +393,12 @@ use common\models\Event;
394 393 </div>
395 394 <div class="row">
396 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 402 </ul>
404 403 </div>
405 404 </div>
... ...
frontend/views/partial/main-menu.php
... ... @@ -73,7 +73,7 @@ $models = Category::find()-&gt;all();
73 73  
74 74 <li>
75 75 <?php
76   - echo Html::a('Статьи', Url::to('/articles/index'))
  76 + echo Html::a('Статьи', Url::to('/articles/main'))
77 77 ?>
78 78 </li>
79 79  
... ...