Magento 中基于属性的产品列表
我想在 Magento 的产品列表中显示“建议”。我创建了一个属性“建议”,它是/否且全局有效。现在,在列表中,我想首先显示建议,然后显示一些文本和内容,然后显示其余产品。
我这样尝试:
$_productCollection=$this->getLoadedProductCollection()
/* .... */
$_productCollection->clear()->addAttributeToFilter('suggestion', 1)->load();
但这以异常结束:
您不能多次定义关联名称“_price_rule”
现在的问题是,如何解决这个问题?
I would like to show "Suggestions" in my product listing in Magento. I made an attribute "Suggestion" which is Yes/No and global active. Now in the listing I would like to show the suggestions first, then some text and stuff, and then the rest of products.
I tried it like this:
$_productCollection=$this->getLoadedProductCollection()
/* .... */
$_productCollection->clear()->addAttributeToFilter('suggestion', 1)->load();
But this ends in an exception:
You cannot define a correlation name '_price_rule' more than once
Now the question is, how to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我的解决方案是一个自定义模块,它扩展了列表功能。我添加了以下文件:
使用以下扩展代码:
然后我在 List.phtml 中加载此方法并且它起作用了:)
无论如何,感谢您的阅读!也许这段代码可以帮助某人!
Ok, the solution for me was a custom module, which extends the List Functionality. I added the following file:
With the following extending code:
Then I loaded this method in the List.phtml and it worked :)
Thanks for reading anyway! Maybe this code helps someone!