brand.php
6.21 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/** @var $this \yii\web\View */
/** @var $productProvider \yii\data\ActiveDataProvider */
/** @var $brandProvider \yii\data\ActiveDataProvider */
use yii\helpers\Url;
use yii\widgets\Breadcrumbs;
use yii\web\View;
use common\modules\product\helpers\ProductHelper;
$this->title = $brand->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('products', 'Brands'), 'url' => ['catalog/brands']];
$this->params['breadcrumbs'][] = $brand->name;
$this->params['seo']['fields']['name'] = $brand->name;
$this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.css'));
$this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.skinHTML5.css'));
$this->registerJsFile (Yii::getAlias('@web/js/ion.rangeSlider.js'));
?>
<script type="text/javascript">
<?php if ($priceLimits['min'] < $priceLimits['max']) :?>
$(document).ready(function() {
// price rangeslider (filter price slider)
$("#price_interval").ionRangeSlider({
type: "double",
min: <?= $priceLimits['min']?>,
max: <?= $priceLimits['max']?>,
from: <?= empty($filter['prices']['min']) ? $priceLimits['min'] : $filter['prices']['min']?>,
to: <?= empty($filter['prices']['max']) ? $priceLimits['max'] : $filter['prices']['max']?>,
grid: false,
onFinish: function(e) {
<?php
$filterWhitoutPrice = $filter;
$filterWhitoutPrice['prices'] = [
'min' => '{from}',
'max' => '{to}',
];
?>
var url = "<?= Url::to(['catalog/brands', 'brand' => $brand, 'filter' => $filterWhitoutPrice])?>";
var from = e.from;
var to = e.to;
document.location = url.replace('{from}', from).replace('{to}', to);
}
});
});
<?php endif?>
</script>
<nav class="bread-crumbs">
<?= Breadcrumbs::widget ([
'links' => $this->params['breadcrumbs'],
])
?>
<div class="both"></div>
</nav>
<div class="loyout">
<div class="leftbar">
<div class="filters">
<ul>
<li class="new">
<?php
$checked = !empty($filter['special']) && in_array('new', $filter['special']);
$option_url = Url::to(['catalog/brands', 'brand' => $brand, 'filter' => ProductHelper::getFilterForOption($filter, 'special', 'new', $checked)]);
?>
<input type="checkbox" class="special-option" <?= $checked ? ' checked' : ''?> onchange="document.location='<?= $option_url?>'" />
<a href="<?= $option_url?>"><?= Yii::t('product', 'New products')?></a>
</li>
<li class="top">
<?php
$checked = !empty($filter['special']) && in_array('top', $filter['special']);
$option_url = Url::to(['catalog/brands', 'brand' => $brand, 'filter' => ProductHelper::getFilterForOption($filter, 'special', 'top', $checked)]);
?>
<input type="checkbox" class="special-option" <?= $checked ? ' checked' : ''?> onchange="document.location='<?= $option_url?>'" />
<a href="<?= $option_url?>"><?= Yii::t('product', 'Top products')?></a>
</li>
<li class="promo">
<?php
$checked = !empty($filter['special']) && in_array('promo', $filter['special']);
$option_url = Url::to(['catalog/brands', 'brand' => $brand, 'filter' => ProductHelper::getFilterForOption($filter, 'special', 'promo', $checked)]);
?>
<input type="checkbox" class="special-option" <?= $checked ? ' checked' : ''?> onchange="document.location='<?= $option_url?>'" />
<a href="<?= $option_url?>"><?= Yii::t('product', 'Promo products')?></a>
</li>
</ul>
</div>
<form action="#" name="filter_catalog_page_form" class="filter-catalog-form">
<?php if (!empty($filter)) :?>
<div class="filter_accept_bloc">
<!-- <button type="submit" class="filter_accept_btn">применить</button>-->
<a href="<?= Url::to(['catalog/brands', 'brand' => $brand])?>" class="_form_checkbox_reset">сбросить фильтры</a>
</div>
<?php endif?>
<?php if ($priceLimits['min'] < $priceLimits['max']) :?>
<div class="cost_box filters">
<div class="begin">Цена</div>
<div class="price_filter first_price_li">
<div class="price_slider">
<input type="text" id="price_interval" name="price_interval" value="" />
</div>
</div>
</div>
<?php endif?>
</form>
</div>
<div class="content">
<h1><?= $brand->name ?></h1>
<div class="sort_menu">
<div class="sort_block">
<span>Сортировка:</span>
<?= \yii\widgets\LinkSorter::widget([
'sort' => $productProvider->sort,
'attributes' => [
'name',
'price',
]
]);
?>
</div>
</div>
<div class="products pn">
<ul>
<?php foreach($productProvider->models as $product) :?>
<?php require(__DIR__ .'/product_item.php')?>
<?php endforeach?>
</ul>
<div class="both"></div>
</div>
<?php if ($productProvider->totalCount > $productProvider->pagination->pageSize) :?>
<?= \yii\widgets\LinkPager::widget([
'pagination' => $productProvider->pagination,
'options' => ['class' => 'pagination pull-right'],
'registerLinkTags' => true,
]);
?>
<?php endif?>
<div class="both"></div>
</div>
<div class="both"></div>
<?= \common\modules\product\widgets\lastProducts::widget()?>
</div>