Commit 9edc01d6c93234f9f8bd927e60c3dd86549de2a7
1 parent
950817c6
сортировка фильтров по имени
Showing
1 changed file
with
44 additions
and
34 deletions
Show diff stats
frontend/views/category/view.php
... | ... | @@ -129,41 +129,51 @@ _________________________________________________________ --> |
129 | 129 | echo '</div>'; |
130 | 130 | } |
131 | 131 | ?> |
132 | - <?php | |
133 | - $brands = $filterHelper->getBrands($model); | |
134 | - if (!empty($brands)) { | |
135 | - ?> | |
136 | - <div class="panel panel-default sidebar-menu"> | |
137 | - <div class="panel-heading"> | |
138 | - <h3 class="panel-title"><?php echo \Yii::t('app', 'Бренды'); ?></h3> | |
139 | - </div> | |
132 | + <?php | |
133 | + $brands = $filterHelper->getBrands($model); | |
134 | + if (!empty($brands)) { | |
135 | + ?> | |
136 | + <div class="panel panel-default sidebar-menu"> | |
137 | + <div class="panel-heading"> | |
138 | + <h3 class="panel-title"><?php echo \Yii::t('app', 'Бренды'); ?></h3> | |
139 | + </div> | |
140 | + | |
141 | + <div class="panel-body"> | |
142 | + <div class="form-group"> | |
143 | + <?php | |
144 | + $nameSortArray=[]; | |
145 | + foreach ($brands as $brand) { | |
146 | + | |
147 | + /** | |
148 | + * @var Product $product | |
149 | + * @var Brand $brand | |
150 | + */ | |
151 | + | |
152 | + $nameSortArray[$brand->lang->title]=Html::tag( | |
153 | + 'div', | |
154 | + Html::a( | |
155 | + $brand->lang->title, | |
156 | + [ | |
157 | + '/category/view', | |
158 | + 'category' => $model->lang->alias->value, | |
159 | + 'filter' => $filterHelper->buildLink($brand), | |
160 | + ] | |
161 | + ), | |
162 | + [ | |
163 | + 'class' => $filterHelper->has( | |
164 | + $brand->lang->alias->value | |
165 | + ) ? 'radio-but checked' : 'radio-but', | |
166 | + ] | |
167 | + ); | |
168 | + | |
169 | + } | |
140 | 170 | |
141 | - <div class="panel-body"> | |
142 | - <div class="form-group"> | |
143 | - <?php | |
144 | - foreach ($brands as $brand) { | |
145 | - /** | |
146 | - * @var Product $product | |
147 | - * @var Brand $brand | |
148 | - */ | |
149 | - echo Html::tag( | |
150 | - 'div', | |
151 | - Html::a( | |
152 | - $brand->lang->title, | |
153 | - [ | |
154 | - '/category/view', | |
155 | - 'category' => $model->lang->alias->value, | |
156 | - 'filter' => $filterHelper->buildLink($brand), | |
157 | - ] | |
158 | - ), | |
159 | - [ | |
160 | - 'class' => $filterHelper->has( | |
161 | - $brand->lang->alias->value | |
162 | - ) ? 'radio-but checked' : 'radio-but', | |
163 | - ] | |
164 | - ); | |
165 | - } | |
166 | - ?> | |
171 | + asort($nameSortArray); | |
172 | + foreach ($nameSortArray as $soloBrandItem) | |
173 | + { | |
174 | + echo $soloBrandItem; | |
175 | + } | |
176 | + ?> | |
167 | 177 | </div> |
168 | 178 | </div> |
169 | 179 | </div> | ... | ... |