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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With