按自定义属性排序
我创建了一个名为“sales_rank”的属性,我已将其设置为可排序属性。然而,当我从产品列表中选择它时,它并没有按照我期望的方式排序。经过进一步检查,它似乎按文本字段排序,而不是数字。这意味着它将变为 101、1014、102、1035、104、11、1204 等......
我该如何解决这个问题?创建属性时,无法告诉它它是一个数字。您可以从“输入验证”框中选择“整数”,这就是答案吗?我还没有尝试过...
有什么想法吗?
谢谢!
I have an attribute I created called "sales_rank" that I have set to use as a sortable attribute. However, when I choose it from the product list, it is not sorting how I expect. On further inspection, it appears that it's sorting as a text field and not as a number. This means that it will go 101, 1014, 102, 1035, 104, 11, 1204, etc....
How do I fix this? When creating the attribute, there's no way to tell it it's a number. You can select "Integer" from the "Input Validation" box, so is that the answer? I haven't tried it yet...
Any thoughts?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试一下,如果仍然不起作用,请回来。数据字段可以保存在多个表中,听起来您正在将此字段保存为字符串(如按字母顺序排序所证明的那样)。
如果您确实想知道它的保存位置,请针对您的数据库运行此查询:
您希望表示数字/整数等。
Try that and come back if it continues not to work. Data fields can be saved in several tables, and it sounds like you are saving this field as a string (as evidenced by the alphabetical sort).
If you really want to know where it is saved, run this query against your database:
You want that to say number/integer, etc.
我在这里找到了我的解决方案: http://www.magentocommerce.com/bug-tracking /issue?issue=7204
基本上,使用“价格”属性类型,因为系统将其视为整数。不漂亮,但它确实是一种享受!
I found my solution here: http://www.magentocommerce.com/bug-tracking/issue?issue=7204
Basically, use the 'price' attribute type because the system sees it as an integer. Not pretty, but it works a treat!