Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
Author « Topic »  

atlend
Advanced Member

USA
359 Posts

Pre-sales questions only
(More Details...)

Posted - 07/28/2026 :  13:26:50  
I was noticing unintended behavior in a discount behavior. I asked Claude to figure it out and gave this as a summary:
[quote]
Subject: Bug in inccart.php — automatic discount minimum quantity compared against price instead of quantity

Summary: For automatic discounts (not coupon codes) that are restricted to specific categories or products (cpnSitewide=3, also affects cpnSitewide=1), the minimum-quantity condition compares the discount's cpnQuantity against the dollar total of the qualifying items instead of their quantity. This makes quantity-based bundle discounts trigger far too easily.

Location: vsadmin/inc/inccart.php, in the automatic-discount eligibility check (~line 1471 in our copy). The four stacked conditions read:
[code]
if( (($rs2['cpnType']==0 && $rs2['cpnThreshold']<=$totprice_ship) || ($rs2['cpnType']!=0 && $rs2['cpnThreshold']<=$totprice_prods)) &&
(($rs2['cpnType']==0 && $rs2['cpnThresholdMax']>$totprice_ship) || ($rs2['cpnType']!=0 && $rs2['cpnThresholdMax']>$totprice_prods) || $rs2['cpnThresholdMax']==0) &&
(($rs2['cpnType']==0 && $rs2['cpnQuantity']<=$totquant_ship) || ($rs2['cpnType']!=0 && $rs2['cpnQuantity']<=$totprice_prods)) && // <-- BUG
(($rs2['cpnType']==0 && $rs2['cpnQuantityMax']>$totquant_ship) || ($rs2['cpnType']!=0 && $rs2['cpnQuantityMax']>$totquant_prods) || $rs2['cpnQuantityMax']==0) ){
[/code]
On the third line, the cpnType!=0 branch uses $totprice_prods (price) where it should use $totquant_prods (quantity). The surrounding lines confirm the intent: the two threshold checks correctly use the price variables, and the max-quantity check on the fourth line correctly uses $totquant_prods.

Fix: change $totprice_prods to $totquant_prods in the marked condition.
[/quote]

Changed it on my version, but thought I would put it out there for the next update. Thanks!

Edited by - atlend on 07/28/2026 13:27:06

Vince
Administrator

43476 Posts

Posted - 07/29/2026 :  03:47:55  
And thank you so much for letting us know the problem AND the resolution!! I've added the fix to the updater and sorry for the problems.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000