Originally Posted by
twitchtoo
Admin > Configuration > Product Info...
Products Info - Product Option Value of Attributes Sort Order
Current Value: 1
Please make any necessary changes
Products Info - Product Option Value of Attributes Sort Order
Sort order of Product Option Values of Attributes for Products Info
0= Sort Order, Price
1= Sort Order, Option Value Name
0
1
Doesn't actually use the options_value_sort_order.
Original:
Code:
if ( PRODUCTS_OPTIONS_SORT_BY_PRICE =='1' ) {
$order_by= ' order by LPAD(pov.products_options_values_sort_order,11,"0"), pov.products_options_values_name';
} else {
$order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pa.options_values_price';
}
Updated:
Code:
if ( PRODUCTS_OPTIONS_SORT_BY_PRICE =='1' ) {
// Twitch change dropdown sort order April 26.2021
// (stock) $order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pov.products_options_values_name';
$order_by= ' order by LPAD(pov.products_options_values_sort_order,11,"0"), pov.products_options_values_name';
} else {
$order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pa.options_values_price';
}
Now the attribute dropdown follows the option value sort order.
Making this change will prevent displaying modifiable sequence of attributes as identified in the attributes controller on a per product basis. Meaning, the attribute sequence will always follow what is set in options values manager for when the PRODUCT_OPTIONS_SORT_BY_PRICE is set to 1 (Products Info - Product Option Value of Attributes Sort Order set to '1').
Note the original code is/was:
Code:
if (PRODUCTS_OPTIONS_SORT_BY_PRICE =='1') {
$order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pov.products_options_values_name';
} else {
$order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pa.options_values_price';
}
Which results in presenting information in the sequence offered by the products attributes table for each of the options. The options are listed in sequence with the sort order that is assigned to each option value within an option name. The sort order for those can be set to the "default" which is the above mentioned products_options_values_sort_order and then the sequence of those can be adjusted to suit for the product (when this change is not applied). Note, if two options have the same sort order then they are sequenced by the products_options_values_name or options_values_price respectively. If that is undesirable then offer a different sort order for each option to enforce the desired sequence.
Put another way, by making the above suggested code change, any effort taken on the products attributes screen to place items in a sequence is lost when PRODUCTS_OPTIONS_SORT_BY_PRICE is set to '1' (Products Info - Product Option Value of Attributes Sort Order set to '1').
What problem was truly trying to be corrected by this change? Further noting that the title of that setting is 'Product Option Value of Attributes Sort Order' which can be read as the Sort Order of Product Option Values as set in the Attributes Controller. The sort order in the associated table is identified as product_options_sort_order but during operation of the manager, that value is set to the products_options_values_sort_order for the specific option value/entry.
Bookmarks