【问题标题】:Is there is any way to remove the filter on clicking the button有什么方法可以在单击按钮时删除过滤器
【发布时间】:2017-01-19 21:21:33
【问题描述】:
<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>

这是我在产品页面中制作应用过滤器按钮的代码。

有没有办法为每个按钮添加一个十字符号(点击后,页面中应用的过滤器将被删除)?

欢迎所有建议。

提前致谢。

Image of the issue

【问题讨论】:

  • 你能说得更具体些吗?
  • 在这段代码中,我在产品页面上获取应用过滤器的值(例如,如果我们点击 24 号尺寸,那么它将显示为顶部的按钮)。但现在我想撤销更改就像我会在每个按钮上单击一个十字图标然后它会删除过滤器。有关更多信息,您可以查看此网站jabong.com/men/clothing/jack-jones/…

标签: javascript php jquery css magento


【解决方案1】:

希望这段代码对您有所帮助。

<?php if ($this->getLayer()->getState()->getFilters()): ?>
    <div class="actions"><a href="<?php echo $this->getClearUrl() ?>"><?php echo $this->__('Clear All') ?></a></div>
<?php endif; ?>

【讨论】:

    猜你喜欢
    • 2011-03-02
    • 1970-01-01
    • 1970-01-01
    • 2016-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-05
    相关资源
    最近更新 更多