Twice_knightly Posted February 14, 2005 Share Posted February 14, 2005 Hi Could someone please tell me how you get the product options to display in the order you want? At the moment mine are listing in alphabetical order which I don't want. Thanks for any help you may be able to offer Cheers Carl. Link to comment Share on other sites More sharing options...
bglkk Posted February 14, 2005 Share Posted February 14, 2005 Products Attributes Sort v1.0 http://www.oscommerce.com/community/contributions,1690/ "Buy the ticket, take the ride..." -HST Link to comment Share on other sites More sharing options...
Twice_knightly Posted February 14, 2005 Author Share Posted February 14, 2005 Products Attributes Sort v1.0 http://www.oscommerce.com/community/contributions,1690/ <{POST_SNAPBACK}> Thanks for the reply, but this sorts the selectable items in the dropdown, what I want to sort is the option names If you have an option of "processor" and "memory" it defaults to listing them as memory [selectable dropdown] processor [selectable dropdown] What I want to do is arrange them in a chosen order, ie Processor [selectable dropdown] memory [selectable dropdown] I've seen it done on lots of OSC sites but so far can sort get menu items sorted (by using the contribution you suggested) Cheers Link to comment Share on other sites More sharing options...
charles Posted February 15, 2005 Share Posted February 15, 2005 I did this a couple of weeks ago. but can't remember where in the forum I found the fix . It is a very simple code change I found in the forum at that time. Once you do the fix, you enter the options into Admin in the order you want them to display because it relys on the option id. In CATALOG/product_info.php change <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name 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"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $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 . "'"); to <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td> </tr> <?php /* CM 2005-02-02 Change options sort order from name to id. Look for 'order by' in two query lines. */ ?> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name 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_id"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $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_id "); HINT: look for the 'order by' stmt - 1 time in old code, 2 times in new code. Good luck, charles We stand in ignorance only for questions not asked. Plug up the leaks in your knowledge base and open up a flood of understanding. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.