Magento分层导航PHP-删除URL中的过滤器


Magento Layered Nav PHP - Remove the filter in URL

我正在操作内置的分层导航过滤器,以使用复选框来代替使用过滤器时显示的"当前购物"部分。我已经成功地设置了复选框系统来添加一个过滤器使用这个:

<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中删除哪个CCD_ 1。

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

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

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

(我知道它仍然很乱,我会清理checkbox/anchor标签等的双URL,并在一切正常后转换为SEO URL)

已解决:

需要使用<?php echo $this->urlEscape($_item->getRemoveUrl()) ?>