2

image #1: https://picasaweb.google.com/lh/photo/gDCgo_SHMbnAOmHCh0LQCtMTjNZETYmyPJy0liipFm0?feat=directlink

When examining a Magento configurable test product (ski goggles with a color option), I see that the colors of the dropdown list (see image #1) are ordered like this: White, Blue, Red, Silver. However, when I examine the product in the admin view and select the "Associated Products" tab, there seems to be no correlation between the frontend list organization and the product ID numbers, price, or anything else for that matter.

To demonstrate, if I connect the product ID numbers to the above list, I get: White (170), Blue (169), Red (168), Silver (175) - see image #2 below.

image #2: https://picasaweb.google.com/lh/photo/ES0i3_wZsdiU35w4_MGLrdMTjNZETYmyPJy0liipFm0?feat=directlink

At the time I initially created the configurable product, I had added three color options (168, 169, 170) and they appeared to be displaying in descending order by ID in the dropdown on the frontend. But I just now added another individual product (the color Silver), with an ID of 175, and it doesn't follow this trend.

Question: What logic does Magento use to order these lists, and what file is this function located in? I'm looking for a way to arrange the config. product dropdown list(s) in ASCENDING order, regardless of price or any other factor, ex. from 168-175.

Thanks.

B

20goto10
  • 71
  • 1
  • 7

3 Answers3

0

Sort order of the attributes is determined in the attribute. The furthest column on the right is called Sort Order.

Otherwise it should sort alphabetically.

elfling
  • 645
  • 5
  • 10
  • In relation to my previous post, the sort order determines the order of the attribute values in the dropdown. Not the order of the sorted products in a product listing. – Coffee123 Jan 11 '16 at 17:26
  • If you go to Catalog > Attributes > Select a drop down attribute Then go to attribute values Furthest right column is Position. If the position isn't populated, it goes by first letter usually. – elfling Jan 12 '16 at 15:11
0

I think what you are looking for is to sort dropdown values (i.e. small, medium, large, extra-large) by some value, and not by its label. If this were done, sorting would make more sense. We would be able so sort by increasing or decreasing size, rather than alphabetical (which does not make sense).

In order for this to happen, we would need magento to support enumerations or oordinal values (https://magento.stackexchange.com/questions/20985/get-option-value-by-id-or-attribute-in-magento, Magento - Sort by Position and Name?). There are NUMEROUS requests for this, which are being ignored.

Please be aware, dropdown values can already be re-ordered. In the admin pages, you can simply drag a dropdown value in M2 in order to change its position (M 1.9 calls this "Sort Orer"). However, the question then becomes how to use the position or sort order [s=1 m=2 l=3 xl=4] of the attribute-value for sorting, rather than its label.

Community
  • 1
  • 1
Coffee123
  • 156
  • 2
  • 9
0

Someone with more experience or knowledge may override me on this, but I believe the order the attribute values appear in the drop down list is based on the order they are given on the attribute label definitions when you create the attribute.

pcproffitt
  • 523
  • 4
  • 10
  • Thanks pcproffitt. In the "Edit Attribute - Manage Label / Options", I rearranged the list position numbers of each of the values, and upon returning to the frontend, the list had indeed been ordered by the position values. Now, is there an easy way to arrange them by product ID in the list, or is that a ridiculous idea? – 20goto10 Mar 02 '12 at 11:25
  • I am not aware of any way to order attribute values by product ID. The fact that product IDs are automatically assigned as products are created and the set of product IDs represented in a configurable product set is dependent on inventory and possibly other factors may explain why. As with all things Magento I'm sure you could custom code something for this. I guess it isn't a default option because most people consider product IDs to be not really indicative of a product. For example if you deleted a product and added a new product to replace it you would get a new product ID. – pcproffitt Mar 02 '12 at 13:12