如何更改magento中产品的显示顺序
如何通过从后端设置一些首选项来更改前端(网格或列表)中的产品显示顺序?我想它应该不是默认 Magento 显示顺序属性中的最佳值和名称。
我尝试创建一个名为 display_order 的新属性,每个产品根据其需要在前端显示的值保存一个值。但是,它不起作用。请帮我解决这个问题。
How can I change the product display order in the front end (grid or list) by setting some preferences from back-end? I guess it should be other than best value and name from the default Magento display order property.
I tried by creating a new attribute called display_order, and each product holds a value based on its value the product needs to shown in front end. However, it is not working. Please help me fix this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要扩展
Mage_Catalog_Block_Product_List
块,以便为getProductCollection()
方法提供您自己的功能。可能是这样的:然后,当然,您必须更新您的自定义控制器上的布局 xml 文件(除非您希望所有产品列表屏幕都像这样)以使用您的新块Magento 默认的
catalog/product_list
。You'll need to extend the
Mage_Catalog_Block_Product_List
block to provide your own functionality for thegetProductCollection()
method. Probably something along the lines of:Then, of course, you'll have to update you layout xml file on your, presumably, custom controller (unless you want all of the product listing screens to act like this) to use your new block instead of the Magento default of
catalog/product_list
.你为什么不使用 Magento 排序工具呢?
在您的类别中,在类别产品下,您可以在最后一列中选择排序顺序。要通过 php 执行此操作,只需创建一个需要启动一次的自定义脚本。
就是这样:)
Why don't you use the Magento sorting thing ?
In your category, under Category Product you have the possibility to choose the sorting order in the last column. To do it through php, just make a custom script that you'll need to launch once.
And that's it :)
要更改显示顺序,首先您需要将默认排序方式选项设置为位置。这可以通过 magento 管理配置完成。之后,您需要为所有以值 1 开头的产品设置位置。
我遇到了以下模块将使此任务变得非常简单,只需从管理类别本身拖放产品即可。请检查以下扩展
http://www.blackqubers.com/extensions/product-sorting-drag-and-drop.html
希望这会对您有所帮助
To change the display order , first you need to set the default sort by option to position.This can be done from the magento admin configuration.After that you need to set position for all the products starting with the value 1.
I come across the following module which will make this task very easy, just by drag and drop the products from the manage categories itself.Please check the following extension
http://www.blackqubers.com/extensions/product-sorting-drag-and-drop.html
Hope this will helps you