Commit 54f69b92e73420aafd9419b71e8a9aacbc35e113

Authored by Yarik
1 parent de8261de

Price filter fix

frontend/views/category/view.php
@@ -164,11 +164,6 @@ _________________________________________________________ --> @@ -164,11 +164,6 @@ _________________________________________________________ -->
164 <?php 164 <?php
165 } 165 }
166 ?> 166 ?>
167 -  
168 - <div class="panel-heading">  
169 - <h3 class="panel-title"><?php echo \Yii::t('app', 'Цена'); ?></h3>  
170 - </div>  
171 -  
172 </div> 167 </div>
173 168
174 <?php 169 <?php
@@ -320,6 +315,9 @@ _________________________________________________________ --&gt; @@ -320,6 +315,9 @@ _________________________________________________________ --&gt;
320 <!-- *** MENUS AND FILTERS END *** --> 315 <!-- *** MENUS AND FILTERS END *** -->
321 316
322 <!-- /.banner --> 317 <!-- /.banner -->
  318 + <div class="panel-heading">
  319 + <h3 class="panel-title"><?php echo \Yii::t('app', 'Цена'); ?></h3>
  320 + </div>
323 <div class="panel-body"> 321 <div class="panel-body">
324 <div class="form-group"> 322 <div class="form-group">
325 <div style="width:200px;"> 323 <div style="width:200px;">
frontend/web/js/script.js
@@ -347,17 +347,22 @@ $(function() { @@ -347,17 +347,22 @@ $(function() {
347 .val(); 347 .val();
348 console.log(max, min); 348 console.log(max, min);
349 var href = window.location.href; 349 var href = window.location.href;
  350 + var question = href.indexOf('?');
  351 + if (question !== -1) {
  352 + var queryString = href.substr(question);
  353 + href = href.substr(0, question);
  354 + }
350 var count = 0; 355 var count = 0;
351 var pos = -1; 356 var pos = -1;
352 while ((pos = href.indexOf('/', pos + 1)) !== -1) { 357 while ((pos = href.indexOf('/', pos + 1)) !== -1) {
353 count++; 358 count++;
354 } 359 }
355 if (count === 5) { 360 if (count === 5) {
356 - window.location.href = href + '/price-' + min + '-' + max; 361 + window.location.href = href + '/price-' + min + '-' + max + queryString;
357 } else { 362 } else {
358 - var result = window.location.href.match(/\/[^\/]*price-(\d+)-(\d+)$/); 363 + var result = href.match(/\/[^\/]*price-(\d+)-(\d+)$/);
359 if (result) { 364 if (result) {
360 - window.location.href = window.location.href.replace(/(\/[^\/]*)price-\d+-\d+$/, '$1price-' + min + '-' + max); 365 + window.location.href = href.replace(/(\/[^\/]*)price-\d+-\d+$/, '$1price-' + min + '-' + max) + queryString;
361 } 366 }
362 } 367 }
363 }); 368 });