Skip to content

Commit

Permalink
work filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Max authored and Max committed Sep 2, 2020
1 parent 3b608a0 commit 4b879ee
Show file tree
Hide file tree
Showing 8 changed files with 191 additions and 89 deletions.
12 changes: 12 additions & 0 deletions app/controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,24 @@ public function indexAction(){
$idAlias = $category->id;
$recursCategory($idAlias);



$breadCrumbs = BreadcrumbsRender::getBreadcrumbs($idAlias,"","view");


$arrCategoryProducts = Pagination::getCurrentProducts($arrCategoryProducts,App::$app->getProperty("pagination"));
$htmlPagination = Pagination::getHtmlPagination();

if(isAJAX()){
// TODO
// $filter = trim($_GET['filter'],",");
// $filter = explode(',', $filter);
// $arrProductsId = \R::findAll('product', 'WHERE id = SELECT attribute_product attr_id = 2');
// debug($arrProductsId);
// die();

}

$this->setMeta("category:{$alias}","escort",'pussy,foxy');
$this->set(compact('arrCategoryProducts','breadCrumbs','htmlPagination'));

Expand Down
86 changes: 1 addition & 85 deletions app/views/Product/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,91 +246,7 @@ class="img-responsive zoom-img" src="/images/<?= $item['img'] ?>"
</div>

</div>
<div class="col-md-3 single-right">
<div class="w_sidebar">
<section class="sky-form">
<h4>Catogories</h4>
<div class="row1 scroll-pane">
<div class="col col-4">
<label class="checkbox"><input type="checkbox" name="checkbox" checked=""><i></i>All
Accessories</label>
</div>
<div class="col col-4">
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Women
Watches</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Kids
Watches</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Men
Watches</label>
</div>
</div>
</section>
<section class="sky-form">
<h4>Brand</h4>
<div class="row1 row2 scroll-pane">
<div class="col col-4">
<label class="checkbox"><input type="checkbox" name="checkbox" checked=""><i></i>kurtas</label>
</div>
<div class="col col-4">
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Sonata</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Titan</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Casio</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Omax</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>shree</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Fastrack</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Sports</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Fossil</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Maxima</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Yepme</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Citizen</label>
<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Diesel</label>
</div>
</div>
</section>
<section class="sky-form">
<h4>Colour</h4>
<ul class="w_nav2">
<li><a class="color1" href="#"></a></li>
<li><a class="color2" href="#"></a></li>
<li><a class="color3" href="#"></a></li>
<li><a class="color4" href="#"></a></li>
<li><a class="color5" href="#"></a></li>
<li><a class="color6" href="#"></a></li>
<li><a class="color7" href="#"></a></li>
<li><a class="color8" href="#"></a></li>
<li><a class="color9" href="#"></a></li>
<li><a class="color10" href="#"></a></li>
<li><a class="color12" href="#"></a></li>
<li><a class="color13" href="#"></a></li>
<li><a class="color14" href="#"></a></li>
<li><a class="color15" href="#"></a></li>
<li><a class="color5" href="#"></a></li>
<li><a class="color6" href="#"></a></li>
<li><a class="color7" href="#"></a></li>
<li><a class="color8" href="#"></a></li>
<li><a class="color9" href="#"></a></li>
<li><a class="color10" href="#"></a></li>
</ul>
</section>
<section class="sky-form">
<h4>discount</h4>
<div class="row1 row2 scroll-pane">
<div class="col col-4">
<label class="radio"><input type="radio" name="radio" checked=""><i></i>60 % and
above</label>
<label class="radio"><input type="radio" name="radio"><i></i>50 % and above</label>
<label class="radio"><input type="radio" name="radio"><i></i>40 % and above</label>
</div>
<div class="col col-4">
<label class="radio"><input type="radio" name="radio"><i></i>30 % and above</label>
<label class="radio"><input type="radio" name="radio"><i></i>20 % and above</label>
<label class="radio"><input type="radio" name="radio"><i></i>10 % and above</label>
</div>
</div>
</section>
</div>
</div>
<div class="clearfix"></div>

</div>
</div>
</div>
Expand Down
52 changes: 52 additions & 0 deletions public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,55 @@ $(".cart-order").on('click','.del-item', function (e) {
})
})

$("body").on('change', '.w_sidebar input', function (e) {

let arrCheckedInput = $('.w_sidebar input:checked');
let data = '';
arrCheckedInput.each(function () {
data += this.value + ",";
});

if(data){
$.ajax({
type: 'GET',
url: location.href,
data: {filter:data},
beforeSend:function(){
$(".preloader").fadeIn(300,function () {
$('.product-one').hide();

});
},
success: function(resp) {
$(".preloader").fadeOut(500,function () {
history.pushState(resp,1);
$('.product-one').html(resp).fadeIn();
let str = location.search.replace(/f(.+?)($|&)/g,'');
console.log(str);
});
},
error: function() {
console.log("Product not exist");
}
});


}else {

window.location = window.location.pathname;
}
})














2 changes: 1 addition & 1 deletion tmp/cache/0832c1202da8d382318e329a7c133ea0.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a:2:{s:4:"data";a:14:{i:1;a:5:{s:5:"title";s:3:"Men";s:5:"alias";s:3:"men";s:9:"parent_id";s:1:"0";s:8:"keywords";s:3:"Men";s:11:"description";s:3:"Men";}i:2;a:5:{s:5:"title";s:5:"Women";s:5:"alias";s:5:"women";s:9:"parent_id";s:1:"0";s:8:"keywords";s:5:"Women";s:11:"description";s:5:"Women";}i:3;a:5:{s:5:"title";s:4:"Kids";s:5:"alias";s:4:"kids";s:9:"parent_id";s:1:"0";s:8:"keywords";s:4:"Kids";s:11:"description";s:4:"Kids";}i:4;a:5:{s:5:"title";s:22:"Электронные";s:5:"alias";s:11:"elektronnye";s:9:"parent_id";s:1:"1";s:8:"keywords";s:22:"Электронные";s:11:"description";s:22:"Электронные";}i:5;a:5:{s:5:"title";s:24:"Механические";s:5:"alias";s:13:"mehanicheskie";s:9:"parent_id";s:1:"1";s:8:"keywords";s:13:"mehanicheskie";s:11:"description";s:13:"mehanicheskie";}i:6;a:5:{s:5:"title";s:5:"Casio";s:5:"alias";s:5:"casio";s:9:"parent_id";s:1:"4";s:8:"keywords";s:5:"Casio";s:11:"description";s:5:"Casio";}i:7;a:5:{s:5:"title";s:7:"Citizen";s:5:"alias";s:7:"citizen";s:9:"parent_id";s:1:"4";s:8:"keywords";s:7:"Citizen";s:11:"description";s:7:"Citizen";}i:8;a:5:{s:5:"title";s:12:"Royal London";s:5:"alias";s:12:"royal-london";s:9:"parent_id";s:1:"5";s:8:"keywords";s:12:"Royal London";s:11:"description";s:12:"Royal London";}i:9;a:5:{s:5:"title";s:5:"Seiko";s:5:"alias";s:5:"seiko";s:9:"parent_id";s:1:"5";s:8:"keywords";s:5:"Seiko";s:11:"description";s:5:"Seiko";}i:10;a:5:{s:5:"title";s:4:"Epos";s:5:"alias";s:4:"epos";s:9:"parent_id";s:1:"5";s:8:"keywords";s:4:"Epos";s:11:"description";s:4:"Epos";}i:11;a:5:{s:5:"title";s:22:"Электронные";s:5:"alias";s:14:"elektronnye-11";s:9:"parent_id";s:1:"2";s:8:"keywords";s:22:"Электронные";s:11:"description";s:22:"Электронные";}i:12;a:5:{s:5:"title";s:24:"Механические";s:5:"alias";s:16:"mehanicheskie-12";s:9:"parent_id";s:1:"2";s:8:"keywords";s:24:"Механические";s:11:"description";s:24:"Механические";}i:13;a:5:{s:5:"title";s:9:"Adriatica";s:5:"alias";s:9:"adriatica";s:9:"parent_id";s:2:"11";s:8:"keywords";s:9:"Adriatica";s:11:"description";s:9:"Adriatica";}i:14;a:5:{s:5:"title";s:10:"Anne Klein";s:5:"alias";s:10:"anne-klein";s:9:"parent_id";s:2:"12";s:8:"keywords";s:10:"Anne Klein";s:11:"description";s:10:"Anne Klein";}}s:8:"time_end";i:1598964429;}
a:2:{s:4:"data";a:14:{i:1;a:5:{s:5:"title";s:3:"Men";s:5:"alias";s:3:"men";s:9:"parent_id";s:1:"0";s:8:"keywords";s:3:"Men";s:11:"description";s:3:"Men";}i:2;a:5:{s:5:"title";s:5:"Women";s:5:"alias";s:5:"women";s:9:"parent_id";s:1:"0";s:8:"keywords";s:5:"Women";s:11:"description";s:5:"Women";}i:3;a:5:{s:5:"title";s:4:"Kids";s:5:"alias";s:4:"kids";s:9:"parent_id";s:1:"0";s:8:"keywords";s:4:"Kids";s:11:"description";s:4:"Kids";}i:4;a:5:{s:5:"title";s:22:"Электронные";s:5:"alias";s:11:"elektronnye";s:9:"parent_id";s:1:"1";s:8:"keywords";s:22:"Электронные";s:11:"description";s:22:"Электронные";}i:5;a:5:{s:5:"title";s:24:"Механические";s:5:"alias";s:13:"mehanicheskie";s:9:"parent_id";s:1:"1";s:8:"keywords";s:13:"mehanicheskie";s:11:"description";s:13:"mehanicheskie";}i:6;a:5:{s:5:"title";s:5:"Casio";s:5:"alias";s:5:"casio";s:9:"parent_id";s:1:"4";s:8:"keywords";s:5:"Casio";s:11:"description";s:5:"Casio";}i:7;a:5:{s:5:"title";s:7:"Citizen";s:5:"alias";s:7:"citizen";s:9:"parent_id";s:1:"4";s:8:"keywords";s:7:"Citizen";s:11:"description";s:7:"Citizen";}i:8;a:5:{s:5:"title";s:12:"Royal London";s:5:"alias";s:12:"royal-london";s:9:"parent_id";s:1:"5";s:8:"keywords";s:12:"Royal London";s:11:"description";s:12:"Royal London";}i:9;a:5:{s:5:"title";s:5:"Seiko";s:5:"alias";s:5:"seiko";s:9:"parent_id";s:1:"5";s:8:"keywords";s:5:"Seiko";s:11:"description";s:5:"Seiko";}i:10;a:5:{s:5:"title";s:4:"Epos";s:5:"alias";s:4:"epos";s:9:"parent_id";s:1:"5";s:8:"keywords";s:4:"Epos";s:11:"description";s:4:"Epos";}i:11;a:5:{s:5:"title";s:22:"Электронные";s:5:"alias";s:14:"elektronnye-11";s:9:"parent_id";s:1:"2";s:8:"keywords";s:22:"Электронные";s:11:"description";s:22:"Электронные";}i:12;a:5:{s:5:"title";s:24:"Механические";s:5:"alias";s:16:"mehanicheskie-12";s:9:"parent_id";s:1:"2";s:8:"keywords";s:24:"Механические";s:11:"description";s:24:"Механические";}i:13;a:5:{s:5:"title";s:9:"Adriatica";s:5:"alias";s:9:"adriatica";s:9:"parent_id";s:2:"11";s:8:"keywords";s:9:"Adriatica";s:11:"description";s:9:"Adriatica";}i:14;a:5:{s:5:"title";s:10:"Anne Klein";s:5:"alias";s:10:"anne-klein";s:9:"parent_id";s:2:"12";s:8:"keywords";s:10:"Anne Klein";s:11:"description";s:10:"Anne Klein";}}s:8:"time_end";i:1599041070;}
2 changes: 1 addition & 1 deletion tmp/cache/9297fd88a237b4c249515d1022b29f09.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ a:2:{s:4:"data";s:1590:"


</li>
";s:8:"time_end";i:1598964429;}
";s:8:"time_end";i:1599042201;}
2 changes: 1 addition & 1 deletion tmp/cache/c799f92d1280fb7a5aefeba08b6fae16.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a:2:{s:4:"data";a:5:{i:1;s:16:"Механизм";i:2;s:12:"Стекло";i:3;s:14:"Ремешок";i:4;s:12:"Корпус";i:5;s:18:"Индикация";}s:8:"time_end";i:1598961322;}
a:2:{s:4:"data";a:5:{i:1;s:16:"Механизм";i:2;s:12:"Стекло";i:3;s:14:"Ремешок";i:4;s:12:"Корпус";i:5;s:18:"Индикация";}s:8:"time_end";i:1599040416;}
2 changes: 1 addition & 1 deletion tmp/cache/d8f64461fa85104a39f2162f647f08aa.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a:2:{s:4:"data";a:5:{i:1;a:4:{i:1;s:48:"Механика с автоподзаводом";i:2;s:47:"Механика с ручным заводом";i:3;s:42:"Кварцевый от батарейки";i:4;s:69:"Кварцевый от солнечного аккумулятора";}i:2;a:3:{i:5;s:20:"Сапфировое";i:6;s:22:"Минеральное";i:7;s:20:"Полимерное";}i:3;a:4:{i:8;s:16:"Стальной";i:9;s:14:"Кожаный";i:10;s:20:"Каучуковый";i:11;s:20:"Полимерный";}i:4;a:6:{i:12;s:33:"Нержавеющая сталь";i:13;s:29:"Титановый сплав";i:14;s:12:"Латунь";i:15;s:14:"Полимер";i:16;s:16:"Керамика";i:17;s:16:"Алюминий";}i:5;a:2:{i:18;s:20:"Аналоговые";i:19;s:16:"Цифровые";}}s:8:"time_end";i:1598961322;}
a:2:{s:4:"data";a:5:{i:1;a:4:{i:1;s:48:"Механика с автоподзаводом";i:2;s:47:"Механика с ручным заводом";i:3;s:42:"Кварцевый от батарейки";i:4;s:69:"Кварцевый от солнечного аккумулятора";}i:2;a:3:{i:5;s:20:"Сапфировое";i:6;s:22:"Минеральное";i:7;s:20:"Полимерное";}i:3;a:4:{i:8;s:16:"Стальной";i:9;s:14:"Кожаный";i:10;s:20:"Каучуковый";i:11;s:20:"Полимерный";}i:4;a:6:{i:12;s:33:"Нержавеющая сталь";i:13;s:29:"Титановый сплав";i:14;s:12:"Латунь";i:15;s:14:"Полимер";i:16;s:16:"Керамика";i:17;s:16:"Алюминий";}i:5;a:2:{i:18;s:20:"Аналоговые";i:19;s:16:"Цифровые";}}s:8:"time_end";i:1599040416;}
Loading

0 comments on commit 4b879ee

Please sign in to comment.