0

I have created product attribute named Custom Sort Catalog >> Attributes >> Manage Attributes

Catalog Input Type for Store Owner as Text Field Input Validation for Store Owner as Decimal

and i'm using this attribute as default sort for my products Catalog >> Manage Categories in category edit page under Display Settings i have set Default Product Listing Sort By as my attribute Custom Sort

but the issue is magento sorts the products in following way 1 11 2 3

I would like to sort products in following way 1 2 3 11

Please guide me how to achieve this

  • 1
    please reindex from admin – Amit Bera Feb 11 '15 at 9:47
  • reindex makes no difference :( – androidjunky Feb 11 '15 at 9:56
1

Actually the sorting works properly. If your attribute has the type "text" the sorting will work on strings.
So from the strings point of view 11 < 2.
You need to have the attribute as decimal.
The Input Validation for Store Owner fields means just a simple validation. It does not mean that the attribute type will be decimal.
The value is still saved as varchar.

See this on how to create a product attribute programatically.

If you want to create the attribute from the UI and have the type 'decimal', I'm not sure what type you have to choose. I think price but not sure.

  • Thanks @Marius, i got it, i should give sort order like a b .. z .. za zb – androidjunky Feb 11 '15 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.