index.php
3.61 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
<?
use yii\helpers\Url;
use yii\widgets\Breadcrumbs;
use app\models\Catalog;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\web\View;
use yii\widgets\LinkPager;
use app\models\Fasovka;
use app\models\Type;
use app\models\Brends;
?>
<?
$this->title = $catalog->meta_title;
$this->registerMetaTag(['name' => 'description', 'content' => $catalog->meta_description]);
$this->registerMetaTag(['name' => 'keywords', 'content' => $catalog->meta_keywords]);
$this->registerJs("
$('#filters-form .checkbox label').click(function() {
$( '#filters-form input[type=\"hidden\"]' ).remove();
$('#filters-form').submit();
});
", View::POS_READY, 'filters-form');
?>
<nav class="bread-crumbs">
<?= Breadcrumbs::widget([
'links' => [
['label'=>'Каталог','url'=>['catalog/all']],
['label'=>$catalog->parent->name,'url'=>['catalog/index','translit'=>$catalog->parent->translit]],
$catalog->name
],
]) ?>
<div class="both"></div>
</nav>
<div class="layout">
<div class="burger"><i></i><i></i><i></i></div>
<div class="leftbar">
<div class="close"><i></i><i></i><i></i></div>
<div class="filtes_box"><div class="w">
<?php $form = ActiveForm::begin(['id' => 'filters-form','method'=>'get','action'=>['products/index','translit'=>$catalog->translit]]); ?>
<?php echo $form->field($modelProducts, 'fasovka')->label($catalog->catFasovka)->checkboxList(ArrayHelper::map($modelProducts->fasovkaAll($catalog->id), 'id', 'name')); ?>
<?php echo $form->field($modelProducts, 'type')->label($catalog->catType)->checkboxList(ArrayHelper::map($modelProducts->typeAll($catalog->id), 'id', 'name')); ?>
<?php echo $form->field($modelProducts, 'brends')->label($catalog->catBrends)->checkboxList(ArrayHelper::map($modelProducts->brendsAll($catalog->id), 'id', 'name')); ?>
<?php ActiveForm::end(); ?>
</div></div>
</div>
<div class="content">
<div class="fr">
<?
$vowels = ['&order=0','&order=1','&order=2','&order=3'];
$q = str_replace($vowels, "",$_SERVER['QUERY_STRING']);?>
<select class="form-control" onchange="document.location='?<?=$q?>&order='+this.value;">
<option value="0">Сортировка</option>
<option <?if(!empty($_GET['order']) && $_GET['order']==1):?>selected<?endif;?> value="1">От дешевых к дорогим</option>
<option <?if(!empty($_GET['order']) && $_GET['order']==2):?>selected<?endif;?> value="2">От дорогих к дешевым</option>
<option <?if(!empty($_GET['order']) && $_GET['order']==3):?>selected<?endif;?> value="3">По алфавиту</option>
</select>
</div>
<h1><?=$catalog->name?></h1>
<div class="ten2"></div>
<?foreach($products as $item):?>
<?= $this->render('_product',['item'=>$item,'num'=>3]) ?>
<?endforeach;?>
<div class="both"></div>
<?=LinkPager::widget([
'pagination' => $pages,
'registerLinkTags' => true
]);?>
<div class="ten2"></div>
<?=$catalog->body?>
</div><div class="both"></div>
</div>