Twitch show attribute price sorted by highest value on product listing and product info pages.
Zen 1.55f live site - includes/functions/functions_prices.php
In the function zen_get_products_base_price
Around line 130
// do not select display only attributes and attributes_price_base_included is true
$product_att_query = $db->Execute("**select options_id**, price_prefix, options_values_price, attributes_display_only, attributes_price_base_included, round(concat(price_prefix, options_values_price), 5) as value from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and attributes_display_only != '1' and attributes_price_base_included='1'". " **order by options_id**, value");
I picked up the **products_options_sort_order **from the table and now we **order by sort:
**
// do not select display only attributes and attributes_price_base_included is true
// Twitch show attribute price sorted by highest value on product listing and product info pages
$product_att_query = $db->Execute("select options_id, price_prefix, options_values_price, attributes_display_only, attributes_price_base_included, products_options_sort_order, round(concat(price_prefix, options_values_price), 5) as value from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and attributes_display_only != '1' and attributes_price_base_included='1'". " order by products_options_sort_order ASC, value");
Now, the **ASC **can be replaced with **DESC **if you need to reverse the order - just remember that **YOU **have to get the numbers of sort correctly ordered **1, 2 ,3, 4, **or 2, 4, 6, 8... 1, 3, 14, 4, 5, 2, 3 would have mixed results.
Here's where things get a little spicy...
Admin product > collect_info:
Priced by Attribute*** - Yes (this client needs the highest attribute price to be the display price)
-Note: A No here will prevent the display from showing any price at all if the product_price RT/WS will
Retail Price - $0.00 (unless you want to add the price to the display)
Wholesale Price - $0.00 (if you have Twitch Wholesale, Dual pricing or others installed)
Attributes Controller:
Included in Base Price -** Enabled **(purple icon selected for each attribute)
Note: A Disabled icon will prevent the display from showing any value where the products_price is shown.
It's likely best to enable each attribute to ensure the display is consistent. Alternately one could hide the attribute pricing without changing the function of adding the selection to the shopping cart correctly.
Set the Sort Order of each attribute in the order you would like them to appear.
Redoc Note: In the future there will be a switch included in the Twitch Modules group to select how the attributes should be ordered similar to the Twitch Product Control Switch.
This fix will work for anyone looking to control the order of their attributes on the product listing mentioned here:
https://www.zen-cart.com/showthread.php?213211-How-to-set-which-attributes-price-to-be-display-on-product-listing&p=1245962