search.php
5.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/** @var $this \yii\web\View */
/** @var $productProvider \yii\data\ActiveDataProvider */
/** @var $brandProvider \yii\data\ActiveDataProvider */
use yii\helpers\Url;
use common\modules\product\helpers\ProductHelper;
$page_data = [
    'keywords' => implode(' ', $keywords),
];
if (!empty($category)) {
    $page_data['category'] = $category->name;
}
$this->title =  Yii::t('product', "Search for \"{keywords}\"". (empty($category) ? '' : ' in category \"{category}\"'), $page_data);
$this->params['seo']['seo_text'] = 'TEST SEO TEXT';
$this->params['seo']['h1'] = 'TEST H1';
$this->params['seo']['description'] = 'TEST DESCRIPTION';
$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD';
$this->params['seo']['key']= 'product_list';
?>
<div class="w_960">
    <?php if(!empty($categories)) :?>
    <!-- side bar with all filters -->
    <div class="cat_p_filter_bar">
        <div class="title">Категории</div>
        <div class="filter_list">
            <ul>
            <?php foreach ($categories as $_category) :?>
                <li><a href="<?= Url::to(['catalog/category', 'category' => $_category, 'word' => implode(' ', $keywords)])?>"><?= $_category->name?></a></li>
            <?php endforeach?>
            </ul>
        </div>
    </div>
    <?php endif?>
    <!-- catalog list with all item cards -->
    <div class="cat_p_catalog_list">
        <div class="title"><?= Yii::t('product', "Search for \"{keywords}\"". (empty($category) ? '' : ' in category "{category}"'), $page_data)?><span><?= $productProvider->totalCount ? ' ('.$productProvider->totalCount .')' : ''?></span></div>
        <?php if (!$productProvider->count) :?>
            <h2>По данному запросу товары не найдены.</h2><br>
            <?php if (!empty($category)) :?>
            <p>Показать <a href="<?= Url::to(['catalog/category', 'category' => $category])?>">все товары из категории "<?= $category->name?>"</a></p>
            <?php endif?>
        <?php else :?>
            <!-- sort menu -->
            <div class="sort_menu">
                <div class="sort_price">
                    <span>Сортировка:</span>
                    <?= \yii\widgets\LinkSorter::widget([
                        'sort' => $productProvider->sort,
                        'attributes' => [
                            'name',
                            'price',
                        ]
                    ]);
                    ?>
                </div>
                <div class="show">
                    <!--<span>Показывать по:</span>
                    <ul>
                        <li><a class="active" href="#">24</a></li>
                        <li><a href="#">48</a></li>
                        <li><a href="#">96</a></li>
                    </ul>-->
                </div>
                <?php if ($productProvider->totalCount > $productProvider->pagination->pageSize) :?>
                <div class="show_pages">
                    Страница:
                    <?= \yii\widgets\LinkPager::widget([
                        'pagination' => $productProvider->pagination,
                        'options' => ['class' => 'pagination pull-right'],
                    ]);
                    ?>
                </div>
                <?php endif?>
            </div>
            <div class="cat_p_item_card_list">
                <div class="novelty">
                    <div class="content">
                        <div class="novelty_cont">
                            <?php foreach($productProvider->models as $product) :?>
                                <?php require(__DIR__ .'/product_item.php')?>
                            <?php endforeach?>
                        </div>
                        <?php if ($productProvider->totalCount > $productProvider->pagination->pageSize) :?>
                            <!-- LOAD MORE BUTTON -->
                            <!--button class="load_more_btn">Загрузить еще <?= $productProvider->pagination->pageSize?> товара</button-->
                            <div class="show_pages">
                                Страница:
                                <?= \yii\widgets\LinkPager::widget([
                                    'pagination' => $productProvider->pagination,
                                    'options' => ['class' => 'pagination pull-right'],
                                ]);
                                ?>
                            </div>
                        <?php endif ?>
                        <hr>
                        <?php if(!empty($category->description)) :?>
                            <div class="description">
                                <?= $category->description?>
                                <div class="empty_padding_400"></div>
                            </div>
                        <?php endif?>
                    </div>
                </div>
            </div>
        <?php endif?>
    </div>
    <?= \common\modules\product\widgets\lastProducts::widget()?>
</div>