Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Change Display price with attribute LARGEST price not lowest

Change Display price with attribute LARGEST price not lowest

Views: 2,234

Results 1 to 4 of 4
9 Jun 2012, 9:34 PM
#1
bubbadan avatar

bubbadan

New Zenner

Join Date:
Apr 2005
Location:
TN
Posts:
96
Plugin Contributions:
0

Change Display price with attribute LARGEST price not lowest

I would like to do two things

  1. I would like to have the "Display price with attribute" be the HIGHEST price NOT the lowest price which is the default.

  2. I am using the Online Group Pricing Mod

( I realize I may have to find someone to pay to modify this, but thought I would ask here first in case there is a mod already (that I didn't see) or a semi-easy fix for this)

On viewing the tpl_product_info_display.php
The mod Strikes out the first shown attribute listing and shows Your Price and then the discount amount.
I would LOVE to have the original price shown on ALL attributes and have that struck out with the red line and then show the discounted price.
This again would be for ALL prices for the product.

My products come in liquid sizes
16 oz
8 oz
4 oz
2 oz

So in conclusion I would like the 16 oz size shown instead of what is automatically shown (The 2 oz price)
and I would like all Regular prices shown, but struck out and the discount price shown.

Any help at least on the first request - would be appreciated

Thanks
Bubba

10 Jun 2012, 1:24 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Change Display price with attribute LARGEST price not lowest

Not sure how much it will help, but you can set all but the largest size attribute "include in base price" to "no". This will make the starting price show for the large size.

6 Feb 2020, 11:28 PM
#3
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Change Display price with attribute LARGEST price not lowest

Setting the attribute sort order will also define when each attribute should display.

7 Feb 2020, 4:37 AM
#4
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Change Display price with attribute LARGEST price not lowest

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