Forums / Bug Reports / coupon value error 1.3.6 (including tax)

coupon value error 1.3.6 (including tax)

Locked

Views: 1,846

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
23 Dec 2006, 2:57 PM
#1
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

coupon value error 1.3.6 (including tax)

Not sure if this has been adressed before, it seems weird that nobody has noticed. But I had problems with the discount coupon showing the wrong value on a default 1.3.6 shop (display prices with tax set to true).

I am quite sure it's a bug in ot_coupon.php, because $tax appears to hold the absolute tax value and is passed to zen_calculate_tax (which expects a tax percentage I assume).

When I change (in ot_coupon.php):

      if (DISPLAY_PRICE_WITH_TAX == 'true') {
        $od_amount['total'] += zen_calculate_tax($od_amount['total'], $tax);
      }

To:

      if (DISPLAY_PRICE_WITH_TAX == 'true') {
        //$od_amount['total'] += zen_calculate_tax($od_amount['total'], $tax);
        $od_amount['total'] += $tax;
      }

It shows the correct discount amount including tax (in my case, only done one test until now though)

#######################
Note:

Also the help popup (popup_coupon_help) shows the amounts (coupon value and minimum order amount) excluding tax while it should show including tax. Haven't looked into that yet.

23 Dec 2006, 5:41 PM
#2
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: coupon value error 1.3.6 (including tax)

I just did some other tests. The fix works well for absolute discounts (showing prices including tax, using one tax rate), but for percentage discounts it does not help.

Since I have no plans to use percentage discounts in the near future, I think I will leave it like this. If you need percentage discounts you may want to look at: http://www.zen-cart.com/forum/showthread.php?t=50014 (it's about group discounts, but maybe the discount coupon problems are related?)

4 Jan 2007, 10:42 AM
#3
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: coupon value error 1.3.6 (including tax)

Is it possible to confirm, or deny, that the above fix is correct (by one of the developers)?

I see others fixing the same issue like this:

      if (DISPLAY_PRICE_WITH_TAX == 'true') {
//        $od_amount['total'] += zen_calculate_tax($od_amount['total'], $tax);
        $od_amount['total'] += zen_calculate_tax($od_amount['total'], $tax_rate);
      }
```using the tax_rate, i.s.o. adding the calculate (absolute) tax value.

But this seems unlogical to me since the programmer calculates the tax value just above the formentioned lines, and when the tax_rate is being used i.s.o. the tax, this calculated tax value is never being used!

So it seems the programmer really intended to add this calculated tax value, not the rate.
4 Jan 2007, 8:38 PM
#4
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,927
Plugin Contributions:
3

Re: coupon value error 1.3.6 (including tax)

Paulm

Haven;t had a chance to test the code yet, just wanted to say that I will do. I'm currently looking at the code for order totals anyway to try and wheedle out the few places that are still causing the infamous 0.01 bug(s) :)

Ian

5 Jan 2007, 10:36 AM
#5
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: coupon value error 1.3.6 (including tax)

Ok thanks for letting me know Ian,

and hopefully this reports helps a little to make improvements.