Guest Posted November 5, 2004 Share Posted November 5, 2004 does anybody know of an contrib or mod to sort attributes by option name? Product Attributes Sort Order v1.0 seems to only sort by value, any other contribs or options available. :-" Quote Link to comment Share on other sites More sharing options...
OceanRanch Posted November 5, 2004 Share Posted November 5, 2004 You can change the query directly in the catalog.product_info.php file and add the sort to the end of the query. Find this code: $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); and change it to this $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' order by pov.products_options_values_name"); HTH Tom Quote Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2004 Share Posted November 5, 2004 Thanks for the quick response...I will make the changes and let you know how it works. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2004 Share Posted November 5, 2004 I made the changes as you suggested, but I am still unable to sort by product option name, it still sorts aphabetically, which doesn't work for me. are we missing something? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2004 Share Posted November 5, 2004 you can see the out come here http://stoneagearchery.com/catalog/product...&products_id=28 Quote Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2004 Share Posted November 5, 2004 matrixxx63, I don't think anyone's written that. The contributions have focused on sorting the values in the drop downs, not the order of the display of available options. It shouldn't be hard to hack together. ed Quote Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2004 Share Posted November 5, 2004 Ed, being new to oscommerce my knowlege of the code is neal. I haven't much of a clue as to what would be needed and how to get started. If you have any suggestions, I would greatly appreciate it. Howard Quote Link to comment Share on other sites More sharing options...
Guest Posted November 6, 2004 Share Posted November 6, 2004 Howard, I just want to be clear on my understanding. Using the order by in the SQL, your attributes show as: Bamboo Backing add $75.00: Bow wood: Draw length: Hickory Backing add $75.00: Inlay antler: Inlay exotic wood: Inlay horn: Length of bow: etc. You want to change the order that they are listed. Not the order of the values in the drop down. Right? ed Quote Link to comment Share on other sites More sharing options...
Guest Posted November 6, 2004 Share Posted November 6, 2004 correct. I need to have length of bow, poundage, draw lenght first. and still would want to sort the rest in certain order. alpabetically just doesn't work. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 6, 2004 Share Posted November 6, 2004 Howard, I don't know of any contributions that do that. Master Products or QTPro might but I don't know them well enough to say. I'm planning on updating Unique Attributes in the next 2 weeks and could add this in. Let me know. ed Quote Link to comment Share on other sites More sharing options...
Guest Posted November 7, 2004 Share Posted November 7, 2004 that would be great, let me know if i can help. Quote Link to comment Share on other sites More sharing options...
OceanRanch Posted November 7, 2004 Share Posted November 7, 2004 Howard, I noticed from one of earlier posts that you have installed "Options Type Feature" contribution. I don't have that code, however in the standard product_info.php there are two queries that you would change. The first query sorts the attribute options by alphabetical name. Then within each attribute there is a query that retrieves the actual drop down values. The default product_info.php has no sort on the second query. My post above sorts the drop downs into alphabetical order. If you want the first query to sort the Attributes by "id" that would allow you to add the attribute and display it in the sequence you added it to the database. However since you are using a contribution, you'd need to make the query/sort changes within the contribution, or go back to the original product_info.php and make the appropriate sort changes. Tom Quote Link to comment Share on other sites More sharing options...
Guest Posted November 9, 2004 Share Posted November 9, 2004 Tom, thanks for your help. I removed all the sort contrib's and only have the option type contrib installed. I need to research the code and figure out how to add the sort to the attribute option value and option name, these would be two distinct sorts. Mevid may have a solution developed soon. thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted November 17, 2005 Share Posted November 17, 2005 You can change the query directly in the catalog.product_info.php file and add the sort to the end of the query. Find this code: $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); and change it to this $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' order by pov.products_options_values_name"); HTH Tom Thanks, Tom. This did the trick. (I adapted it to sort by id.) And thanks for your many contributions to the community. This newbie sure appreciates your generosity! Troy Quote Link to comment Share on other sites More sharing options...
WEB11 Posted November 19, 2005 Share Posted November 19, 2005 I have Attribute Sets Plus contrib installed, how could I change this to order the options by attribute sets name? Is it possible? Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.