Forums / Bug Reports / [Done v1.3.9] Bug in Quantity Discounts for mixed attribute products

[Done v1.3.9] Bug in Quantity Discounts for mixed attribute products

Locked

Views: 3,236

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
26 Sep 2008, 7:34 PM
#1
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

[Done v1.3.9] Bug in Quantity Discounts for mixed attribute products

Totals are not computed correctly, which leads to some products not getting the quantity discount they should even when products price manager has discount qty applies to mixed attributes = Yes.

This can be duplicated by setting discount level 1 min qty 10 and adding (say) 4 then 8 of the same product with different attribute settings.

Fix is in includes/classes/shopping_cart.php. Add the line

reset($check_contents);

immediately below line 1436 in 1.3.8a and 1430 in 1.3.7.1

Scott

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

26 Sep 2008, 7:51 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [Done v1.3.9] Bug in Quantity Discounts for mixed attribute products

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

26 Sep 2008, 7:53 PM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: [Done v1.3.9] Bug in Quantity Discounts for mixed attribute products

You're absolutely right - I scanned the thread for "quantity discounts" and didn't see it - sorry for the double post.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

4 Jun 2009, 7:45 PM
#4
traderdog avatar

traderdog

New Zenner

Join Date:
Jan 2009
Posts:
9
Plugin Contributions:
0

Re: [Done v1.3.9] Bug in Quantity Discounts for mixed attribute products

Hi. Not sure if anyone is still following this thread, or if this is the right place to ask this.

Months ago I updated includes/classes/shopping_cart.php with the extra line of code in the posts above to solve this issue. Now it seems to have stopped working, at least partially. I've re-created and re-uploaded it twice in the last two days to no avail.

I'm using 1.3.8 with Tabbed Products Pro, Google Analytics, StaticList and Cart SideBox with Button and Free Shipping mods. (I uninstalled this last one to see if it was causing the problem but it was not.) At one point I was also using the Quantity Discount mod, but have uninstalled that as well.

Product is "Priced by Attributes", price is set to $0.00. Each of the two attributes has a price assigned to it in the Attributes Controller and both "Apply Discounts Used..." and "Include in Base Price..." are set to to yes. Prices are correct on the drop-down menu on the site page. The lowest priced attribute calculates correctly when I add 1, 2 or 3 to the cart. The higher priced attribute calculates correctly if I add 2 or 3. However, if I only add 1 to the cart, the name (option value) is correct, but the price is that of the lower priced attribute. A link to the page is below.

I'm not sure what I've changed over the course of the past several months to upset this little apple cart. If anyone has a suggestion I'd greatly appreciate it.

Thanks.

http://www.whiskergifters.com/index.php?main_page=product_info&cPath=1_6_16&products_id=31

4 Jul 2009, 6:15 AM
#5
alexexela avatar

alexexela

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: [Done v1.3.9] Bug in Quantity Discounts for mixed attribute products

traderdog, I do not know if this is fixed in newer version or not, but I dug deep enough to solve a similar problem.

In the file functions_prices.php - line 1247~1249:

//no discount applies
$discounted_price = zen_get_products_actual_price($product_id);
break;

This part totally ignore the existence of the attribute price passed to the function... to correct, replace the above with the following:

//no discount applies
// priced by attributes
if ($check_amount != 0) {
$discounted_price = $check_amount;
} else {
$discounted_price = zen_get_products_actual_price($product_id);
}
break;

You can do the same thing for case '0' too (just right below the mentioned code)

10 Sep 2009, 9:33 PM
#6
friedrich72 avatar

friedrich72

New Zenner

Join Date:
May 2009
Location:
Kansas
Posts:
39
Plugin Contributions:
0

Re: [Done v1.3.9] Bug in Quantity Discounts for mixed attribute products

wow this 2006 post is still alive and well. thanks for the tip, alexexela.
Had quantitiy discounts that were overriding pricing attribute options. your fix seems to have worked like a charm.
Thank you!