homerS Posted February 10, 2005 Share Posted February 10, 2005 hi! does anyone know how to sort the options in the product_info? for example, i want to have Size [Radio Button] Text [Text Box] Color [Drop Down] but the options are listed alphabetically: Color Size Text any ideas? thanks! Quote Link to comment Share on other sites More sharing options...
homerS Posted February 10, 2005 Author Share Posted February 10, 2005 nobody? :'( Quote Link to comment Share on other sites More sharing options...
bdneuman Posted February 10, 2005 Share Posted February 10, 2005 hi! does anyone know how to sort the options in the product_info? for example, i want to have Size [Radio Button] Text [Text Box] Color [Drop Down] but the options are listed alphabetically: Color Size Text any ideas? thanks! <{POST_SNAPBACK}> Yeah, I've researched this before. I have BTS installed and the code is found in my template/contents directory, filename product_info.tpl.php. I believe standard installation without BTS would be in catalog/product_info.php. Find this code around line 150: //clr 030714 update query to pull option_type $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); The very last line, change order by popt.products_options_name to order by popt.products_options_id and it will sort by the ID of the product option. Just make sure that you enter your product options in admin in the order you want them to appear in the catalog. You can sort the attributes in the drop down, select list options, too. It's found further down in the file and looks like this: //clr 030714 default is select list //clr 030714 reset selected_attribute variable $selected_attribute = false; $products_options_array = array(); $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 = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . "order by pov.products_options_values_name"); Insert the code in blue to sort alphabetically, or, replace "name" with "id" to sort in order of entery into admin. I've found with so many options in my drop-down lists, that if I want the list in a certain non-alphebetical order, I just add "A. Option #1", "B. Option #2" and so on. Works for me... Hope this helps. Quote Brian Neuman Link to comment Share on other sites More sharing options...
homerS Posted February 10, 2005 Author Share Posted February 10, 2005 SO SIMPLE!!! thanks very much! :thumbsup: 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.
Note: Your post will require moderator approval before it will be visible.