rockstar_clothing Posted January 12, 2005 Posted January 12, 2005 Hi, I think we all know the problems associated with the attributes, for example if I have sizes 6,7,8,9 theyre often displayed 9,6,7,8 on the product info page. I've got around 300 items in my store now and am looking for a solution to sort these. I've looked round the forums but all i can really find is the attribute sort contrib which means you have to go through each product and manually sort each attribute which would take weeks for me. I was thinking is there a simple mod you can do on the page or even an sql fix that you can use to sort the attributes? This ones driving me mad! Hope someone can help!
Zeme Posted January 24, 2005 Posted January 24, 2005 I would suggest you install a contribution that adds a sort-order field. I know that you said you have 300 products and that you don't want to modify the attributes for all of those products, but it really is the most versatile option. Now, if you would rather not add new fields to the DB, the Attribute Sort contribution seems to state that it does not require a sort-order field. As long as you added the attributes in numerical order (6,7,8,9), they should come out that way. Now, getting back to my previous suggestion (adding a field). If you decide to add a new attribute field to your DB, consider using some SQL statements to update all your existing attributes. For example if you have: Option value ID: 62 - Size - 6 Option value ID: 13 - Size - 7 you can update all of your existing product-attributes with the following SQL statements: UPDATE products_attributes SET products_options_sort_order='1' WHERE options_values_id='62'; UPDATE products_attributes SET products_options_sort_order='2' WHERE options_values_id='13'; NOTE: In the code above, I made all "Size - 6" order=1 and "Size - 7" order=2 just on a whim, the sort_order field just orders them from lowest value to highest value. Also, the code above assumes that the sort_order field is called "products_options_sort_order" (The Attributes Sorter and Copier contribution for example, has this field, and works well for me (though I am still in the site setup phase)). You will only have to write 1 SQL statement for each of your Option Values (probably much less than 300). Then your whole dataset will be updated. SQL statements are usually your best bet for updating large amounts of data simultaneously. Oh, also, if you check out the "Attributes Sorter and Copier" I mentioned, you'll notice that it has a "sort order" column added to the Option Values table too, this is for "defaults", so you won't have to specify a sort-order each time you add an attribute to a new product, it will be pulled from the default for that Option Value. I was just trying to write an sql code for you that would update all your existing attributes using the new "defaults", but a 1 line solution seems to be outside my reach (mysql doesn't like what I think should be valid code). If you have some php skill though, it may be possible to write a simple script that goes through all the products_options_values_to_products_options default sort-orders and puts them in the existing products_attributes' new sort-order field....but since I haven't written one yet, I cannot say for sure if this would be more or less work than just running a single SQL for each existing Option Value entry. (as stated above, in code). Good luck, and happy coding. Hi, I think we all know the problems associated with the attributes, for example if I have sizes 6,7,8,9 theyre often displayed 9,6,7,8 on the product info page. I've got around 300 items in my store now and am looking for a solution to sort these. I've looked round the forums but all i can really find is the attribute sort contrib which means you have to go through each product and manually sort each attribute which would take weeks for me. I was thinking is there a simple mod you can do on the page or even an sql fix that you can use to sort the attributes? This ones driving me mad! Hope someone can help! <{POST_SNAPBACK}>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.