Exemple #1
0
 /**
  * @param string $slug
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionView($slug)
 {
     if (null === ($page = Shop::page($slug))) {
         throw new NotFoundHttpException();
     }
     return $this->render("/page/view", ['page' => $page]);
 }
Exemple #2
0
 /**
  * @param $slug
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionView($slug)
 {
     $category = Catalog::cat($slug);
     if (!$category) {
         throw new NotFoundHttpException();
     }
     return $this->render('/category/view', ['category' => $category, 'page' => Shop::page('catalog')]);
 }
Exemple #3
0
 /**
  * @param \yii\web\UrlManager $manager
  * @param string $route
  * @param array $params
  * @return bool|string
  */
 public function createUrl($manager, $route, $params)
 {
     if ($route === 'page/view') {
         $id_slug = null;
         if (isset($params['slug'])) {
             $id_slug = $params['slug'];
         }
         if (isset($params['id'])) {
             $id_slug = $params['id'];
         }
         $page = Shop::page($id_slug);
         if ($page) {
             return $page->model->slug;
         }
     }
     return false;
 }
Exemple #4
0
 /**
  * @return string
  */
 public function actionAbout()
 {
     return $this->render('about', ['page' => Shop::page(Pages::ABOUT)]);
 }
Exemple #5
0
 /**
  * @return string
  */
 public function actionFail()
 {
     return $this->render('fail', ['page' => Shop::page(Pages::ORDER_FAILED)]);
 }
Exemple #6
0
 /**
  * @return string
  */
 public function actionIndex()
 {
     $cart = Cart::get();
     $cart->normalize();
     return $this->render('index', ['page' => Shop::page(Pages::SHOPPING_CART), 'cart' => $cart]);
 }
Exemple #7
0
 /**
  * @return string
  */
 public function actionIndex()
 {
     return $this->render('index', ['page' => Shop::page(Pages::WISH_LIST), 'wishList' => WishList::get()]);
 }
Exemple #8
0
 /**
  * @param $q
  * @return string
  */
 public function actionSearch($q)
 {
     $products = Catalog::search(trim($q), ['sort' => ['attributes' => ['name', 'price', 'rating']]]);
     return $this->render('search', ['products' => $products, 'page' => Shop::page(Pages::SEARCH_RESULTS)]);
 }