Zen Cart Logo
Forums / General Questions / Quantity Discounts not calculating correctly using mixed attribs

Quantity Discounts not calculating correctly using mixed attribs

Locked

Views: 3,466

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
30 Dec 2007, 5:04 PM
#1
crankyjim avatar

crankyjim

New Zenner

Join Date:
Nov 2006
Posts:
20
Plugin Contributions:
0

Quantity Discounts not calculating correctly using mixed attribs

Hello all. I'm using the built in quantity discounts feature of Zencart. For some reason, I'm having issues though with the discount calculation.

example. I have a product that goes from 18.50 to 18.00 when you buy 6 or more.

If I purchase 3 of one attribute set, it sets the 3 at 18.50 each (correct).
If I then purchase 3 more of another attribute set (color, size), then those 3 are correctly priced at 18.00 each, but the previous 3 remain at 18.50 each (incorrect).

If, on the other hand, I purchase 6 of one attribute set, then the cost is correctly calculated at 18.00 each.

Using zencart 1.3.6.

Any advice would be appreciated.

30 Dec 2007, 11:46 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity Discounts not calculating correctly using mixed attribs

Have you an URL to this product that we could peek at please?

31 Dec 2007, 5:31 AM
#4
crankyjim avatar

crankyjim

New Zenner

Join Date:
Nov 2006
Posts:
20
Plugin Contributions:
0

Re: Quantity Discounts not calculating correctly using mixed attribs

a small addition. we have 5 different products with the same pricing / discount structure and they're all having the same problem.

31 Dec 2007, 5:56 AM
#5
crankyjim avatar

crankyjim

New Zenner

Join Date:
Nov 2006
Posts:
20
Plugin Contributions:
0

Re: Quantity Discounts not calculating correctly using mixed attribs

one other addition.

if you add an unrelated item to the cart, then the discount is removed entirely. not even the 3 which were correct will show the discounted value.

if you then add another of the same discounted product, that single one will show the correct discounted price, but not the other two attribute groups.

very strange.

31 Dec 2007, 6:10 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Quantity Discounts not calculating correctly using mixed attribs

Are you using a Stock-handling add-on for this?

I have not seen a problem with Product Quantity Discounts ...

I set up this same scenario without a stock track and no problems ... at least I am guessing that color list with the quantities means something?

31 Dec 2007, 6:24 AM
#7
crankyjim avatar

crankyjim

New Zenner

Join Date:
Nov 2006
Posts:
20
Plugin Contributions:
0

Re: Quantity Discounts not calculating correctly using mixed attribs

the only stock add-on we're using is the Stock By Attributes. I've asked in that support thread and apparently it doesn't touch the quantity discount functionality.

I've been using winmerge to try to find some changes in the various php files that could be causing the issue, but I'm having a difficult time following the program flow after the add to cart button is clicked and how it then refreshes the prices with quantity discount taken into account. Not sure which php is responsible for doing the recalc and re-display of the item costs.

As a test earlier today, I installed a new version of zencart 1.3.8, connected it to a copy of the current database. I upgraded the database to 1.3.8 and installed only the Stock By Attributes add-on.

Same problem.

4 Jan 2008, 8:14 AM
#8
crankyjim avatar

crankyjim

New Zenner

Join Date:
Nov 2006
Posts:
20
Plugin Contributions:
0

Re: Quantity Discounts not calculating correctly using mixed attribs

ok, now I'm stuck.

I've uploaded and installed a fresh copy of zen cart 1.3.8a.
I've let it create a brand new database.
I've added one product with a quantity discount applied.
It does NOT work.

Fresh database. Fresh cart. Still unable to calculate qty discounts properly.

I think I've eliminated the program and any possible database corruption. Where do I look next?

Could there be something on the server?

http://www.weecarediapercompany.com/store

4 Jan 2008, 8:54 PM
#9
drbyte avatar

drbyte

Sensei

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

Re: Quantity Discounts not calculating correctly using mixed attribs

try this edit:

/includes/classes/shopping_cart.php
at lines 1401 and 1435 you have code that looks like this:// reset($this->contents); // breaks cart $check_contents = $this->contents; while (list($products_id, ) = each($check_contents)) {add an extra line in both places, making it look like this:```
// reset($this->contents); // breaks cart
$check_contents = $this->contents;
[B] reset($check_contents);[/B]
while (list($products_id, ) = each($check_contents)) {

5 Jan 2008, 3:01 AM
#10
crankyjim avatar

crankyjim

New Zenner

Join Date:
Nov 2006
Posts:
20
Plugin Contributions:
0

Re: Quantity Discounts not calculating correctly using mixed attribs

That was the solution!!!

Has this issue not come up before? Are we selling in an unusual way? Either way, I'm very grateful for your solution!!!

Thank you very much!!!!

31 Jan 2008, 8:48 AM
#11
pe7er avatar

pe7er

New Zenner

Join Date:
Apr 2007
Location:
Nijmegen, Netherlands
Posts:
44
Plugin Contributions:
0

Re: Quantity Discounts not calculating correctly using mixed attribs

DrByte:

try this edit:

/includes/classes/shopping_cart.php
at lines 1401 and 1435 you have code that looks like this:

I have Zen Cart v1.3.7.1 and noticed that identical products
with different attributes
are seen as different products regarding product discount.

Product 1 with Attribute option 1 (chosen attribute value = 1)
and
Product 1 with Attribute option 1 (but now attribute value = 2 is chosen)
won't get a Quantity Discount. It's like they are seen as seperate (and not identical) products.

Do I have to configure something in order to accomplish that those products with different chosen attribute values are see as the same product for Quantity Discount?
Or can I use DrByte's modification in /includes/classes/shopping_cart.php to get it like that?

1 Feb 2008, 10:57 PM
#12
drbyte avatar

drbyte

Sensei

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

Re: Quantity Discounts not calculating correctly using mixed attribs

I don't know for sure.
But it's safe to make the edit I suggested in my earlier post. It's actually applicable to 1.3.6 and 1.3.7.x and 1.3.8.x

6 Feb 2008, 11:46 PM
#13
pe7er avatar

pe7er

New Zenner

Join Date:
Apr 2007
Location:
Nijmegen, Netherlands
Posts:
44
Plugin Contributions:
0

Re: Quantity Discounts not calculating correctly using mixed attribs

DrByte:

But it's safe to make the edit I suggested in my earlier post. It's actually applicable to 1.3.6 and 1.3.7.x and 1.3.8.x

Yes, I used your modification in 1.3.7.x and now it works correctly!
Thank you for this information!