Nice simple little contribution.

As default this contribution orders everything however It wants. Until you set the order ID they remain in an unorganised way.

This little mod will sort the attributes by price unless an option ID is entered.

If the option id is the same (to start they are all 0) then the lowest price attribute is displayed.

Tested with v1.8.x

All you are doing is adding "pa.options_values_price" at the end. Its saying if the attribute sort is the same then order by price.

I cant really take much credit for this. My inspiration came from the "Sorting Attributes" contribution from way back in 05

I hope it helps someone out.

DamanC aka Daman


================================================== ==

Open /catalog/product_info.php


Find:

$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 pa.attribute_sort");

Replace:

$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 pa.attribute_sort, pa.options_values_price");

================================================== ==

More...