Attributes +/-

Started by IDEASLady on 23 Oct 2026, 6:24 AM · Views: 135

Results 1 to 4 of 4
23 Oct 2026, 6:24 AM
#1
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,456
Plugin Contributions:
4

Attributes +/-

Something weird is going on with my attributes. It's the first I've seen this "wrong" behavior.

If you have a "Priced by Attributes" item, let's say "$500". And you have 2 options:

  • 50% the price (like a deposit) / you will set it as "-" 250
  • Full price = won't have anything

This should show in front the same way, but instead what I'm getting is: "+ $750" and the full price will show fine. Even though, when added to cart with the 50%, it shows in cart correctly $250.

This only happens with the minus (-), not with the plus (+). The plus shows fine as "+ 250".

IDEASLady
IDEAS Creative Studio

Your image... our business!

23 Oct 2026, 6:13 PM
#2
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,456
Plugin Contributions:
4

Re: Attributes +/-

It seems to be a bug (v2.1) that still on v2.2.2 because I just tried it on Softaculous demo version.

IDEASLady
IDEAS Creative Studio

Your image... our business!

23 Oct 2026, 7:18 PM
#3
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,900
Plugin Contributions:
22

Re: Attributes +/-

You're right, this is a core bug, and it's still there in the current development code.

In includes/functions/functions_prices.php, zen_get_attributes_price_final() handles a "-" prefix on a Priced by Attributes product by subtracting (base − option) and then subtracting the base price again. With a $500 base and a "-" 250 option, that's −250 − 500 = −750, which is why the product page shows "( -$750.00 )". The "+" path works it out correctly, and so does the shopping cart, which is why your cart total is right.

Quick workaround (no code): edit that attribute and set "Apply Discounts Used by Product Special/Sale" to No. The display then uses the option's own value. The catch: a sale or special won't discount that attribute.

Code fix (2.1.0 and later): in includes/functions/functions_prices.php, find (around line 1281 in 2.2.2):

    if ($price_prefix === '-') {
        $attributes_price_final -= zen_get_discount_calc($products_id, $products_attributes_id, ($prod_priced_by_attr ? $products_price_without_attributes : 0) + ($prod_priced_by_attr ? -1 : 1) * $options_values_price);
    } else {

and replace it with:

    if ($price_prefix === '-') {
        if ($prod_priced_by_attr) {
            $attributes_price_final += zen_get_discount_calc($products_id, $products_attributes_id, $products_price_without_attributes - $options_values_price);
        } else {
            $attributes_price_final -= zen_get_discount_calc($products_id, $products_attributes_id, $options_values_price);
        }
    } else {

That makes the minus case match the plus case: −250 on a $500 item now displays as −$250.

Don't apply this to 1.5.x or 2.0.x. Those versions calculate this differently: there the minus amount is already right and it's the plus amount that's wrong.

The fix for core is submitted as PR #8040.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

23 Oct 2026, 9:05 PM
#4
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,456
Plugin Contributions:
4

Re: Attributes +/-

Perfect! 🙂 Muchas gracias.

IDEASLady
IDEAS Creative Studio

Your image... our business!