Magento 中的分层导航类别
我希望增强 Magento 中的分层导航。
目前,分层导航中使用的属性无法分组,这意味着如果您有多个逻辑上位于一组的属性(即属性“高度”、“宽度”和“深度”,即“尺寸”和“颜色”和“纹理”属于“外观”部分)。
我认为这将增强用户的可用性和导航。
在我继续为此开发模块之前,我想知道是否有人遇到过类似的 magento 功能,如果没有,您有什么建议可以做到这一点吗?
约瑟夫
I'm looking to enhance the layered navigation in Magento.
Presently, attributes that are used in layered navigation can't be grouped, meaning if you have several attributes that are logically in one group (i.e. attributes "height", "width" & "depth" which are "Dimensions", and "color" and "texture" belong in an "Appearance" section).
I think this would enhance the usability and navigation for users.
Before I go ahead and begin developing a module for this, I was wondering if anyone came across something like this for magento, and if not, do you have any tips how this should be done?
Joseph
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我为此创建了一个模块。以下是我所做的更改:
MyName/Navigation/Catalog/Model/Layer.php:
我只是重写了 Mage_Catalog_Model_Layer 中的重写函数,并添加了以下行:
这确保了在我需要时将加载组数据。
接下来的两个更改仅允许您访问数据。
MyName/Navigation/Catalog/Model/Layer/Attribute.php:
MyName/Navigation/Catalog/Model/Layer/Item.php:
MyName/Navigation/Catalog/Block/Layer/Filter/Attribute.php:
告诉magento使用我的模块而不是核心文件。
MyName/Navigation/etc/config.xml
调用
现在您可以从模板文件中 :template/catalog/layer/filter.php
或
$_filter->getGroupName();
来自您的模板文件:template/catalog/layer/view.php
并对属性进行分组/排序。
I created a module for this. Here are the changes I made:
MyName/Navigation/Catalog/Model/Layer.php:
I'm just rewriting the overridden function from Mage_Catalog_Model_Layer with that addition of the line:
This ensures that the group data will be loaded when I need it.
The next two changes just allow you to access the data.
MyName/Navigation/Catalog/Model/Layer/Attribute.php:
MyName/Navigation/Catalog/Model/Layer/Item.php:
MyName/Navigation/Catalog/Block/Layer/Filter/Attribute.php:
Tell magento to use my module and not the core files.
MyName/Navigation/etc/config.xml
Now you can call
from your template file: template/catalog/layer/filter.php
or
$_filter->getGroupName();
from your template file: template/catalog/layer/view.php
and Group/Sort the attributes from there.
过滤导航的代码已经在 Magento 论坛上存在很长时间了,它在最新版本中仍然有效:
http://www.magentocommerce.com/boards/viewthread/5500/
这可能会提供您自定义过滤导航的外观以满足您的需求所需的内容。
您还可以在属性中定义分层导航中的排序顺序。不要使用“1、2、3”,而是使用“100、200、300”,以便稍后您可以将“宽度”定义为 210 等,并将属性插入到您需要的排序顺序中。
The code for the filtered navigation has been on the Magento forums for a long time, it still works in the most recent versions:
http://www.magentocommerce.com/boards/viewthread/5500/
This may provide what you need to customise the appearance of the filtered navigation to suit your needs.
You can also define in your attribute the sort order in the layered navigation. Rather than use '1, 2, 3' go for '100, 200, 300' so that later on you can define - say - 'width' to 210, etc. and slot the attributes in to the sort order you need.