diff --git a/frontend/config/main.php b/frontend/config/main.php index 57a9791..98d0a06 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -53,11 +53,11 @@ return [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ - '' => 'site/index', - 'login' => 'login/index', - 'iam' => 'iam/index', - 'text/' => 'text/index', - '/text/' => 'text/index', + '' => 'site/main', + 'login' => 'login/main', + 'iam' => 'iam/main', + 'text/' => 'text/main', + '/text/' => 'text/main', [ 'class' => '\common\modules\product\CatalogUrlManager', 'route_map' => [ @@ -68,16 +68,17 @@ return [ ] ], + 'cabinet/main' => '/cabinet/main', 'priceparam.xml' => 'site/priceparam', 'price.xml' => 'site/price', 'smstest' => 'site/sms', - 'search' => 'search/index', + 'search/main' => 'search/main', 'news/-' => 'news/show', - 'brands' => 'catalog/brands', + 'brands/main' => 'catalog/brands', 'brands/' => 'catalog/brand', - 'articles' => 'articles/index', - 'articles/-' => 'articles/show', - 'event' => 'event/index', + 'articles/main' => 'articles/main', + 'articles/' => 'articles/show', + 'event/main' => 'event/main', 'event/sale/' => 'event/sale', 'event/' => 'event/show', ], diff --git a/frontend/controllers/ArticlesController.php b/frontend/controllers/ArticlesController.php index c6645bf..e018052 100755 --- a/frontend/controllers/ArticlesController.php +++ b/frontend/controllers/ArticlesController.php @@ -11,7 +11,7 @@ use yii\data\Pagination; class ArticlesController extends Controller { - public function actionIndex() + public function actionMain() { $query = Articles::find()->groupBy('id')->orderBy('id DESC') ; @@ -29,14 +29,21 @@ class ArticlesController extends Controller 'news'=>$news, ]); } - - public function actionShow(){ - if(!$news = Articles::find()->where(['id'=>$_GET['id']])->one()) - throw new HttpException(404, 'Данной странице не существует!'); - - return $this->render('show', [ - 'news'=>$news, - ]); + public function actionShow($translit){ + $news = $this->findModel($translit); + + + return $this->render('show', [ + 'news'=>$news, + ]); + } + protected function findModel($translit) + { + if (($model = Articles::findOne(["translit"=>$translit])) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } } } \ No newline at end of file diff --git a/frontend/controllers/BasketController.php b/frontend/controllers/BasketController.php index 01fa1af..822b682 100755 --- a/frontend/controllers/BasketController.php +++ b/frontend/controllers/BasketController.php @@ -10,7 +10,7 @@ public $enableCsrfValidation = false; - public function actionIndex() + public function actionMain() { $response = \Yii::$app->response; $response->format = Response::FORMAT_JSON; diff --git a/frontend/controllers/CabinetController.php b/frontend/controllers/CabinetController.php index e60d215..589d7f7 100755 --- a/frontend/controllers/CabinetController.php +++ b/frontend/controllers/CabinetController.php @@ -40,7 +40,7 @@ class CabinetController extends Controller 'allow' => true, ], [ - 'actions' => ['logout', 'index', 'create', 'update', 'view', 'delete','my-orders','bookmarks'], + 'actions' => ['logout', 'main', 'create', 'update', 'view', 'delete','my-orders','bookmarks'], 'allow' => true, 'roles' => ['@'], ], @@ -55,7 +55,7 @@ class CabinetController extends Controller ]; } - public function actionIndex(){ + public function actionMain(){ return $this->render('index'); } diff --git a/frontend/controllers/EventController.php b/frontend/controllers/EventController.php index 7a8a07f..2084723 100755 --- a/frontend/controllers/EventController.php +++ b/frontend/controllers/EventController.php @@ -13,7 +13,7 @@ use yii\data\ActiveDataProvider; class EventController extends Controller { - public function actionIndex() + public function actionMain() { $dataProvider = new ActiveDataProvider([ diff --git a/frontend/controllers/OrderController.php b/frontend/controllers/OrderController.php index 8f09577..b6c2702 100755 --- a/frontend/controllers/OrderController.php +++ b/frontend/controllers/OrderController.php @@ -17,7 +17,7 @@ class OrderController extends Controller { - public function actionIndex() + public function actionMain() { $basket = \Yii::$app->basket; $data = $basket->getData(); diff --git a/frontend/controllers/SearchController.php b/frontend/controllers/SearchController.php index f3cd224..9aa8b9f 100755 --- a/frontend/controllers/SearchController.php +++ b/frontend/controllers/SearchController.php @@ -11,7 +11,7 @@ use yii\web\HttpException; class SearchController extends \yii\web\Controller { - public function actionIndex() + public function actionMain() { $word = trim(Yii::$app->request->get('word', '')); diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 94905c7..f02c98f 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -20,7 +20,7 @@ class SiteController extends Controller { - public function actionIndex() + public function actionMain() { diff --git a/frontend/controllers/TextController.php b/frontend/controllers/TextController.php index 34e83bf..9b95f70 100755 --- a/frontend/controllers/TextController.php +++ b/frontend/controllers/TextController.php @@ -10,7 +10,7 @@ use yii\web\HttpException; class TextController extends Controller { - public function actionIndex() + public function actionMain() { if(!$modelText = Page::find()->where(['translit'=>$_GET['translit']])->one()) diff --git a/frontend/views/articles/index.php b/frontend/views/articles/index.php index 0804b72..8aafaba 100755 --- a/frontend/views/articles/index.php +++ b/frontend/views/articles/index.php @@ -35,14 +35,12 @@ imageUrl, 'list'), [ 'class' => 'float-left' ]) ?> title ?>
comments) : "Оставить отзыв" ), [ 'articles/show', 'translit' => $item->translit, - 'id' => $item->id, '#' => 'artbox-comment', ]); ?> diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php index 25f0d0d..098bc4f 100755 --- a/frontend/views/catalog/product.php +++ b/frontend/views/catalog/product.php @@ -647,7 +647,7 @@ FlipclockAsset::register($this);
    variant->stocks as $stock){?> -
  • siteName, Url::to (['text/index', 'translit' => 'magaziny', '#'=>$stock->stock_id])) ?>
  • +
  • siteName, Url::to (['text/main', 'translit' => 'magaziny', '#'=>$stock->stock_id])) ?>
diff --git a/frontend/views/layouts/cabinet.php b/frontend/views/layouts/cabinet.php index e4014fc..02664bd 100755 --- a/frontend/views/layouts/cabinet.php +++ b/frontend/views/layouts/cabinet.php @@ -11,7 +11,7 @@ $this->beginContent('@app/views/layouts/main.php');
-
+
diff --git a/frontend/views/layouts/main-menu.php b/frontend/views/layouts/main-menu.php index 57b013f..1d0515e 100755 --- a/frontend/views/layouts/main-menu.php +++ b/frontend/views/layouts/main-menu.php @@ -69,13 +69,13 @@ $models = Category::find()->all();
  • 'diskontnaya-programma'])) + echo Html::a('Дисконтная программа', Url::to (['text/main', 'translit' => 'diskontnaya-programma'])) ?>
  • diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index cb9f288..de96770 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -92,10 +92,10 @@ use common\models\Event;
    -
  • 'magaziny'])) ?>
  • -
  • 'garantii'])) ?>
  • -
  • 'oplata'])) ?>
  • -
  • 'dostavka-tovarov'])) ?>
  • +
  • 'magaziny'])) ?>
  • +
  • 'garantii'])) ?>
  • +
  • 'oplata'])) ?>
  • +
  • 'dostavka-tovarov'])) ?>
  • @@ -107,7 +107,7 @@ use common\models\Event; 'class' => 'cabinet_link_', ]); } else { - echo Html::a('' . Yii::$app->user->identity->username . '', Url::toRoute([ 'cabinet/index' ]), [ 'class' => 'cabinet_link_' ]); + echo Html::a('' . Yii::$app->user->identity->username . '', Url::toRoute([ 'cabinet/main' ]), [ 'class' => 'cabinet_link_' ]); } ?>
    @@ -255,8 +255,7 @@ use common\models\Event;
  • title, Url::to([ 'articles/show', - 'translit' => $article->translit, - 'id' => $article->id, + 'translit' => $article->translit ]))?>
  • @@ -394,12 +393,12 @@ use common\models\Event;
      -
    • 'magaziny'])) ?>
    • -
    • 'garantii'])) ?>
    • -
    • 'oplata'])) ?>
    • -
    • 'dostavka-tovarov'])) ?>
    • -
    • 'diskontnaya-programma'])) ?>
    • -
    • 'o-proekte'])) ?>
    • +
    • 'magaziny'])) ?>
    • +
    • 'garantii'])) ?>
    • +
    • 'oplata'])) ?>
    • +
    • 'dostavka-tovarov'])) ?>
    • +
    • 'diskontnaya-programma'])) ?>
    • +
    • 'o-proekte'])) ?>
    diff --git a/frontend/views/partial/main-menu.php b/frontend/views/partial/main-menu.php index 71fb504..ea5cfa4 100755 --- a/frontend/views/partial/main-menu.php +++ b/frontend/views/partial/main-menu.php @@ -73,7 +73,7 @@ $models = Category::find()->all();
  • -- libgit2 0.21.4