Example #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]);
 }
Example #2
0
 /**
  * @return string|\yii\web\Response
  */
 public function actionProfile()
 {
     $model = User::findIdentity(\Yii::$app->user->identity->getId());
     if ($model->load(\Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['details']);
     }
     return $this->render('profile', ['model' => $model, 'countries' => Shop::countries()]);
 }
Example #3
0
 /**
  * @param $slug
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionView($slug)
 {
     $newsItem = Shop::news_item($slug);
     if (!$newsItem) {
         throw new NotFoundHttpException();
     }
     return $this->render('view', ['newsItem' => $newsItem]);
 }
Example #4
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')]);
 }
Example #5
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;
 }
Example #6
0
 /**
  * @return string
  */
 public function actionAbout()
 {
     return $this->render('about', ['page' => Shop::page(Pages::ABOUT)]);
 }
Example #7
0
    ?>
                        </a>
                    </h3>
                    <p>
                        <?php 
    echo $newsItem->model->announce;
    ?>
                    </p>
                </div>
            </div>
        <?php 
}
?>
    </div>
    <div align="right">
        <?php 
echo Shop::pager();
?>
    </div>
    <?php 
if (!$newsItems) {
    ?>
        <?php 
    echo Html::tag('div', Yii::t('yii', 'No results found.'), ['class' => 'no-results bordered']);
    ?>
    <?php 
}
?>
</div>

Example #8
0
 /**
  * @return string
  */
 public function actionFail()
 {
     return $this->render('fail', ['page' => Shop::page(Pages::ORDER_FAILED)]);
 }
Example #9
0
 /**
  * @return string
  */
 public function actionIndex()
 {
     $cart = Cart::get();
     $cart->normalize();
     return $this->render('index', ['page' => Shop::page(Pages::SHOPPING_CART), 'cart' => $cart]);
 }
Example #10
0
 /**
  * @return string
  */
 public function actionIndex()
 {
     return $this->render('index', ['page' => Shop::page(Pages::WISH_LIST), 'wishList' => WishList::get()]);
 }
Example #11
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)]);
 }