Jump to content

Small, medium, large, x large out of order on attribute dropdown


Recommended Posts

I am having some trouble getting my attributes in the desired sequence. On the product display page, the attributes are listed alphabetically.

Large
Medium
Small
X Large

When using the combinations generator, I have tried to alter the sequence that I select the attributes in but it doesn't change the order in which they display.

How are you getting your sizes in order from smallest to largest? I want them to look like:

Small
Medium
Large
X Large

Link to comment
Share on other sites

The funny thing is, I changed X Large to Extra large, thinking then at least the sizes would be in reverse alphabetical order, right? The sequence didn't change, it stayed the same.

Large
Medium
Small
Extra Large

I think this makes the shop look a bit silly :)

Link to comment
Share on other sites

Below is what I did to get S/M/L correctly:

1/ Add a field position to the database :

ALTER TABLE `ps_attribute_lang` ADD `position` TINYINT NOT NULL DEFAULT '0' AFTER `id_lang` ;



2/ Modify the fields 'position' in table 'ps_attribute_lang' using phpmyadmin to fit the row order. Smaller numbers will show first. Personally, I find the ps_attribute_lang not the right table, it should probably be in ps_attribute, but I was too lazy.

3/ Change the file /classes/Attribute.php : Find function getAttributes($id_lang, $notNull = false) and change

ORDER BY agl.`name` ASC, al.`name` ASC');


to

ORDER BY al.`position` ASC, agl.`name` ASC, al.`name` ASC');



Done. A simple refresh will probably not show the new order because Smarty's caching does not catch this. Try with another product instead.

Link to comment
Share on other sites

I gave it a try and added the table position with no problem. When I went to edit the position for the various attributes, I found that there were many instances of small, large, medium, and extra large. I have used the combinations generator to create my color/size options for my products, so I wonder if this might be what caused that.

I edited the positions in the table, changed the attributes file, and then went into my store's back office. I found that my products were no longer listed in their categories. The categories appeared to be empty even though the front office was fine. I tried refreshing to see if there was any change in S,M,L, XL sequence but there was not.

I ended up just dropping the table position from the database to get the back office back to normal :) It's fine now but I'm still after a workable solution to this problem.

Link to comment
Share on other sites

  • 9 months later...
  • 2 years later...

I have seen a "Order Attribute" module floating around, I have the same issue but with attribute numbers 0123456789 and when I get to ten it goes in front not after 9, pain in the neck!!

Link to comment
Share on other sites

×
×
  • Create New...