开发者

Sorting on Custom Attribute

开发者 https://www.devze.com 2023-02-17 01:46 出处:网络
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

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!


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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消