【问题标题】:Magento Layered Nav PHP - Remove the filter in URLMagento 分层导航 PHP - 删除 URL 中的过滤器
【发布时间】:2012-07-31 11:26:21
【问题描述】:

我正在操作内置的分层导航过滤器以使用复选框代替使用过滤器时出现的“当前购物”部分。我已成功设置复选框系统以使用此添加过滤器:

<input type="checkbox" id="filter-checkbox-<?php echo $_item->getLabel() ?>" class="filter-checkbox" onclick="setLocation('<?php echo $this->urlEscape($_item->getUrl()) ?>');"/> 

 <a href="<?php echo $this->urlEscape($_item->getUrl()) ?>" class="m-notselected-ln-item" title="<?php echo $_item->getLabel() ?>">

<?php echo $_item->getLabel() ?>

</a>

将过滤器添加到未选中的项目(在 else 语句中)很好。我最终得到一个这样的 URL:

category/category.html?filtered_attribute=97&filtered_attribute=105

取消选中该框时,我只是在使用用于 onclick 的 php 时遇到问题。即从 URL 中删除 filtered_attribute=xx

查看标准模板文件 - 删除过滤器按钮使用:

<?php echo $_filter->getRemoveUrl() ?>

但这会破坏页面并导致分层导航的其余部分无法加载。

(我知道它仍然很乱,我会清理复选框/锚标记等的双网址,并在一切正常后转换为 SEO 网址)

【问题讨论】:

    标签: php url magento magento-1.5


    【解决方案1】:

    已解决:

    需要使用&lt;?php echo $this-&gt;urlEscape($_item-&gt;getRemoveUrl()) ?&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-03
      • 2015-10-12
      • 2011-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多