示例#1
0
 public function actionCatalog()
 {
     if (Yii::$app->request->get('slug')) {
         $item = Catalog::get(Yii::$app->request->get('slug'));
         return $this->render('catalog-item', ['item' => $item]);
     }
     $items = Catalog::items();
     return $this->render('catalog-list', ['items' => $items]);
 }
示例#2
0
 public function actionSearch()
 {
     $text = filter_var($_REQUEST['text'], FILTER_SANITIZE_STRING);
     if (Yii::$app->language == 'en') {
         $items = \yii\easyii\modules\catalog\api\Catalog::items(['where' => ['or', ['like', 'title', $text], ['like', 'description', $text]]]);
     } else {
         $slug = 'products';
         $cat = \yii\easyii\modules\catalog\api\Catalog::cat($slug);
         $itemsData = $cat->items();
         foreach ($itemsData as $item) {
             if (strpos($item->title, $text) !== false or strpos($item->description, $text) !== false) {
                 $items[] = $item;
             }
         }
     }
     return $this->render('search', ['text' => $text, 'items' => $items]);
 }
示例#3
0
 public function actionSearch($text)
 {
     $text = filter_var($text, FILTER_SANITIZE_STRING);
     return $this->render('search', ['text' => $text, 'items' => Catalog::items(['where' => ['or', ['like', 'title', $text], ['like', 'description', $text]]])]);
 }
示例#4
0
use yii\easyii\modules\catalog\api\Catalog;
?>

<section id="popular-tracks">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <h2>Популярные <a href="#">туры</a></h2>
            </div>
        </div>
    </div>
    <ul id="works-grid" class="works-grid works-grid-gut works-grid-3 works-hover-w">

        <?php 
foreach (Catalog::items(['pagination' => ['pageSize' => 6]]) as $item) {
    ?>

        <!-- Portfolio item start -->
        <li class="work-item illustration webdesign">
            <a href="/site/catalog?slug=<?php 
    echo $item->slug;
    ?>
">
                <div class="title">
                    <?php 
    echo $item->title;
    ?>
                </div>
                <div class="work-image">
                    <img src="<?php