按自定义属性排序

发布于 2024-10-22 19:15:52 字数 266 浏览 3 评论 0原文

我创建了一个名为“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜司空 2024-10-29 19:15:52

尝试一下,如果仍然不起作用,请回来。数据字段可以保存在多个表中,听起来您正在将此字段保存为字符串(如按字母顺序排序所证明的那样)。

如果您确实想知道它的保存位置,请针对您的数据库运行此查询:

select backend_type from eav_attribute where attribute_code = 'sales_rank';

您希望表示数字/整数等。

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:

select backend_type from eav_attribute where attribute_code = 'sales_rank';

You want that to say number/integer, etc.

丿*梦醉红颜 2024-10-29 19:15:52

我在这里找到了我的解决方案: 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文