Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / discounts are not being calculated correctly?

discounts are not being calculated correctly?

Locked

Views: 2,351

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
30 Jul 2009, 3:04 PM
#1
rastabloke avatar

rastabloke

New Zenner

Join Date:
Dec 2008
Posts:
45
Plugin Contributions:
0

discounts are not being calculated correctly?

Hi,

I've been having a problem with the qty discount. I've searched the forum thoroughly and can't find an answer.

My discount is as follows

1-2 = 9.95
3-5 = 8.95
5+ = 7.95

The problem I'm having is that the discount is only effecting the products after the number is reached. For example, lets say I have 6 items in my cart... this is whats happening.

Item 1 = 9.95
Item 2 = 9.95
Item 3 = 8.95
Item 4 = 8.95
Item 5 = 7.95
Item 6 = 7.95

= 53.7

When in reality, it should work like this.

Item 1 = 7.95
Item 2 = 7.95
Item 3 = 7.95
Item 4 = 7.95
Item 5 = 7.95
Item 6 = 7.95

= 47.7

Any help would be great;)

5 Aug 2009, 12:18 PM
#3
rastabloke avatar

rastabloke

New Zenner

Join Date:
Dec 2008
Posts:
45
Plugin Contributions:
0

Re: discounts are not being calculated correctly?

Re: Known Bugs (and fixes) with v1.3.8
Problem: Minimum or Maximum or Units is not processing with attributes properly when added to cart ... also affects quantity discounts on mixed

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

// 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:
Code:

// reset($this->contents); // breaks cart
$check_contents = $this->contents;
reset($check_contents);
while (list($products_id, ) = each($check_contents)) {

This is the answer that was given, but when I go to do the mod, it says specifically in the code that this will "break the cart".

There has got to be an answer out there, but I can't find it anywhere.

5 Aug 2009, 12:42 PM
#4
kieren avatar

kieren

New Zenner

Join Date:
Aug 2006
Posts:
21
Plugin Contributions:
0

Re: discounts are not being calculated correctly?

What the code says is:

// reset($this->contents); // breaks cart
$check_contents = $this->contents;

But what you're doing is putting the line after:

$check_contents = $this->contents;

and NOT before it. So you'll have:

// reset($this->contents); // breaks cart
$check_contents = $this->contents;
reset($check_contents);

which is different to:

reset($this->contents);
$check_contents = $this->contents;

Of course, you should test any change like this on a test install of your shop and not the live site but this fix worked for me.

Kieren

5 Aug 2009, 1:40 PM
#5
rastabloke avatar

rastabloke

New Zenner

Join Date:
Dec 2008
Posts:
45
Plugin Contributions:
0

Re: discounts are not being calculated correctly?

Thank you for the reply.

I have tried this couple times... with the code in the correct spot of course:D The commented out portion is warning that it will break the cart if put within that block of code.

After following the steps to a "T", it does add the contents of the cart up correctly, but when I try to change pages, things go all white:shocking:

5 Aug 2009, 1:55 PM
#6
kieren avatar

kieren

New Zenner

Join Date:
Aug 2006
Posts:
21
Plugin Contributions:
0

Re: discounts are not being calculated correctly?

I'm not sure what you mean by "change pages". Did you make the change in both places within the code? You need to insert the extra line in two different places.

6 Aug 2009, 1:18 PM
#7
rastabloke avatar

rastabloke

New Zenner

Join Date:
Dec 2008
Posts:
45
Plugin Contributions:
0

Re: discounts are not being calculated correctly?

Kieren:

I'm not sure what you mean by "change pages". Did you make the change in both places within the code? You need to insert the extra line in two different places.

Navigate anywhere away from the "view shopping cart page".. essentially the cart breaks.:frusty:

6 Aug 2009, 1:49 PM
#8
kieren avatar

kieren

New Zenner

Join Date:
Aug 2006
Posts:
21
Plugin Contributions:
0

Re: discounts are not being calculated correctly?

Hmmm and you've made the code change in both places within that one file and you're running 1.3.8a with all the patches applied?

This fix works for me on 1.3.8a with no problems at all.

6 Aug 2009, 7:06 PM
#9
rastabloke avatar

rastabloke

New Zenner

Join Date:
Dec 2008
Posts:
45
Plugin Contributions:
0

Re: discounts are not being calculated correctly?

WOW

I was monkeying around with it... it seems that the cart breaking because of DW cs3. I use it as my ftp client, then edit with notepad because DW messes up php code(adds extra lines).

So I've been editing with notepad. Then re uploading the modified files. It seems like every simple modification I try breaks the cart!

So just for kicks, I took a functional cart... downloaded the shoppingcart.php file, then uploaded it back.... THE CART IS BROKEN AGAIN

It seems DW is screws up the file in transfer.

I think back on all the problems I've had when editing zen cart... most are probably due to this little bug. :frusty:

I think I'm going to start a thread on this and see if anyone else has had this problem. Where do you think I should post it?

Thank you for all your help... I look forward to doing this mod when I figure out what the heck is going on with the DW ftp client

6 Aug 2009, 7:14 PM
#10
drbyte avatar

drbyte

Sensei

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

Re: discounts are not being calculated correctly?

Rastabloke:

I think I'm going to start a thread on this and see if anyone else has had this problem. Where do you think I should post it?Maybe you should look for other threads on that topic before posting another one.
But the matter is certainly off-topic from this present discussion.

.
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.