我正在操作内置的分层导航过滤器来使用复选框,而不是使用过滤器时出现的“当前正在购物”部分。我已经成功地设置了checkbox系统,以便使用以下代码添加过滤器:
<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() ?>但这会破坏页面,并导致分层导航的其余部分无法加载。
(我知道它仍然很混乱,我将清理复选框/锚标签等的双重URL,并在一切正常后转换为SEO URL)
发布于 2012-07-31 11:26:22
已解决:
需要使用<?php echo $this->urlEscape($_item->getRemoveUrl()) ?>
https://stackoverflow.com/questions/11662916
复制相似问题