gpt4 book ai didi

javascript - opencart 价格范围 slider 扩展

转载 作者:行者123 更新时间:2023-11-28 06:16:53 30 4
gpt4 key购买 nike

请帮我更正代码。与其他 javascript 操作冲突的地方。 opencart 中的此价格过滤器正在停止类别页面中“添加到购物车”的操作。以下是在 javascript 中调用 php 的代码。缺少某些内容或编码不正确。

<div class="row">
<div class="slide-filter">
<h2><?php echo $heading_title; ?></h2>
<div class="list-group">
<div class="list-group-item">
<div id="filter-group1">
<div id="scale-slider"></div>
<button type="button" id="button-price-filter" class="filter-button"><?php echo $button_filter; ?></button>
</div>
</div>
</div>
</div>
</div>

JavaScript 是

$("#scale-slider")
.slider({
min: <?php echo round($price_range_min) ; ?>,
max: <?php echo round($price_range_max) ; ?>,
range: true,
values: [<?php echo (isset($price_range[0])?$price_range[0]:0); ?>, <?php echo (isset($price_range[1])?$price_range[1]:$price_range_max); ?>]
})

.slider("pips", {
rest: false,
<?php if (!$right_code) { ?>
prefix: "<?php echo $price_code; ?>",
<?php } else { ?>
suffix: "<?php echo $price_code; ?>"
<?php } ?>
})

.slider("float");
(function( $ ) {
$(function() {
$('#button-price-filter').on('click', function() {
priceRange = [];
$('#scale-slider .ui-slider-tip').each(function(){
priceRange.push($(this).html());
});
$('.<?php echo $product_class; ?>').hide();
$('.clearfix').remove();
$('.<?php echo $product_class; ?>').each(function(){
if( $(this).find( ".price span.price-new" ).length ) {
var price = $(this).find( ".price span.price-new" ).html().replace('<?php echo $price_code; ?>','').replace(',','');
} else {
var text = $(this).find('.price').html().replace('<?php echo $price_code; ?>','');
if( $(this).find( ".price span" ).length ) {
var price = text.substring(0,text.indexOf('<span')).replace(',','');
} else {
var price = text.replace(',','');
}
}
price = parseInt(price);
if( !isNaN(price) && (price > priceRange[0] && price < priceRange[1]) ){
$(this).fadeIn("slow");
}
});
});
});
})(jQuery);

最佳答案

删除$('.clearfix').remove(); ,也许可以完美地工作

关于javascript - opencart 价格范围 slider 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35889809/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com