<div class="col-lg-12 col-sm-12 col-md-12 col-xs-12 space-top-left">
<?php
$appliedFilters = Mage::getSingleton('catalog/layer')->getState()->getFilters();
if ($appliedFilters) {
foreach ($appliedFilters as $item) {
$b=$item->getLabel(); // Currently selected value
?>
<button type="button" class="btn btn-default"><?php echo($b); ?></button>
<?php
}
}
?>
</div>
这是我在产品页面中制作应用过滤器按钮的代码。
有没有办法为每个按钮打叉号(点击后,页面上应用的过滤器将被删除)?
欢迎所有建议。
提前致谢。
最佳答案
希望这段代码能帮到你。
<?php if ($this->getLayer()->getState()->getFilters()): ?>
<div class="actions"><a href="<?php echo $this->getClearUrl() ?>"><?php echo $this->__('Clear All') ?></a></div>
<?php endif; ?>
关于javascript - 有什么方法可以在单击按钮时删除过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41647909/