简体   繁体   English

Magento分层导航中的自定义过滤器

[英]Custom filter in Magento's layered navigation

I have a list of alpha-numeric size attributes that I need to be able to filter, either in advanced search or in layered navigation (I'm referring to Magento, if anyone else decides to remove that from the title). 我有一个我需要能够过滤的字母数字大小属性列表,无论是在高级搜索中还是在分层导航中(如果有人决定从标题中删除,我指的是Magento)。

the problem is that I should be able to set them as intervals. 问题是我应该能够将它们设置为间隔。 Imagine shoe sizes: 25, 25/, 31, 31/. 想象一下鞋码:25、25 /,31、31 /。 I would like to be able to set something like: 我希望能够设置以下内容:

20-25/
26-30
30/-40

With the first filter returning all shoes available in that size interval, obviously. 显然,第一个过滤器返回了该尺寸间隔内所有可用的鞋子。 How can I achieve this? 我该如何实现?

It occurred to me assigning thos intervals as attributes before I export them from SQL Server... Maybe that would save me some trouble... 在我从SQL Server导出属性之前,我想将这些时间间隔指定为属性...也许可以为我省去一些麻烦...

Magento doesn't have an option to make attributes as intervals, only the price attribute is filtered like that. Magento没有选择将属性设置为间隔的选项,仅价格属性被这样过滤。 I think you can do this with 2 attributes: first would be shoe size, and show this one only in the product details page, so you would list values like 25/26/27... and the second would be shoe size interval, an show this one in layered navigation/search and have values like 25-30/30-35/35-40... both of them would be dropdowns in the admin area. 我认为您可以使用2个属性来完成此操作:第一个属性是鞋子的尺码,并且仅在产品详细信息页面中显示此属性,因此您将列出25/26/27之类的值,第二个属性是鞋子的尺码间隔,一个在分层导航/搜索中显示此项目,其值类似25-30 / 30-35 / 35-40 ...两者都将是管理区域中的下拉菜单。

You can make a module that extends Magento's default navigation, you have to rewrite filters block and model from catalog in frontend and attributes from admin so that you can add an extra option to the attribute like "interval". 您可以制作一个扩展Magento默认导航的模块,必须重写前端目录中的过滤器块和模型,以及admin的属性,以便可以向属性添加一个额外的选项,例如“ interval”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM