如果您选择将要检查的品牌并检查也过滤的价格但是当我选择了另一个不会被选中的品牌时请建议我.. 我认为它不会选择多个阵列品牌。我将使用php,jquery和mysqli。
<div class="widget-header">
<h4 class="widget-title">Brand</h4>
</div>
<div class="accordion-group" id="brandname">
<?php
$all_brand=$con->query("SELECT distinct brand FROM `mc_products_tbl` WHERE cat_id = '$_GET[cat_id]' GROUP BY brand");?>
<?php foreach ($all_brand as $key => $new_brand) :
if(isset($_GET['brand'])) :
if(in_array(data_clean($new_brand['brand']),$_GET['brand'])) :
$check='checked="checked"';
else : $check="";
endif;
endif;
?>
<input type="checkbox" value="<?=data_clean($new_brand['brand']);?>" <?=@$check?> name="brand[]" class="sort_rang brand" onchange="filterProducts()"><?=ucfirst($new_brand['brand']); ?>
<?php endforeach; ?>
</div>
<div class="widget-header">
<h4 class="widget-title">Price Range</h4>
</div>
<div class="filter-panel">
<p><input type="hidden" id="price_range" onchange="filterProducts()" value="50,50000"/>
</p>
</div>
function filterProducts() {
var cat_id = $("#cat_id").val();
var subcat_id = $("#subcat_id").val();
var brand = check_box_values('brand');
var price_range = $("#price_range").val();
alert(cat_id);
alert(subcat_id);
alert(brand);
alert(price_range);
var dataString='price_range='+price_range+'&cat_id='+cat_id+'&subcat_id='+subcat_id+'&brand='+brand;
alert(dataString);
$.ajax({
type: "POST",
url: "left_listing_ajax_filter.php",
data: dataString,
cache: false,
// beforeSend: function () {
//$('.container').css("opacity", ".5");
//},
success: function (data) {
if (data != "") {
$('#results').html(data);
//$('.container').css("opacity", "");
}
}
});
function check_box_values(check_box_class){
var values = new Array();
$("."+check_box_class+":checked").each(function() {
values.push($(this).val());
});
return values;
}
$('.sort_rang').change(function(){
$("#search_form").submit();
return false;
});
}
请建议我....如果你选择第二次不会移动到left_listing_ajax_filter文件..请指教我...我正在尝试解决这个问题请帮助我..