Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 54
  1. #11
    Join Date
    Sep 2004
    Posts
    745
    Plugin Contributions
    4

    Default Re: tax calculation problem with coupons and multiple products

    Also, while we are on the subject of the coupon code I have a pet peeve in regard to the implementation of the coupon popup help functionality. In the current implementation there is in place the following code:

    Code:
          $this->output[] = array('title' => $this->title . ': ' . '<a href="javascript:couponpopupWindow(\'' . zen_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $_SESSION['cc_id']) . '\')">' . $this->coupon_code . '</a> :',
                                  'text' => '-' . $currencies->format($od_amount['total']),
                                  'value' => $od_amount['total']);
    This actually causes the anchor href and javascript html to be written out to the order_totals table record of the database! If you later attempt to view/edit the coupon field data using edit_orders or super_orders the html embedded in this order record really screws up the edit order output. As a result we have edited this code in our production store as described below to eliminate writing html out to the order_total table records, which I personally think is a really bad idea anyway.

    Code:
          $this->output[] = array('title' => $this->title . ': ' . $this->coupon_code . ':',
                                  'text' => '-' . $currencies->format($od_amount['total']),
                                  'value' => $od_amount['total']);
    I would really like to see the elimination of html being written out to database records in future versions of the coupon code!

    Thanks,
    Jeff

  2. #12
    Join Date
    Sep 2004
    Posts
    745
    Plugin Contributions
    4

    Default Re: tax calculation problem with coupons and multiple products

    Hi Paul,

    We don't charge tax on shipping here in the states nor do we use the show prices with tax configuration. The code I added to support these is unfortunately pretty much untested as I added it a while back to help a fellow from Germany who was having similar issues as you are now. Let me set up a test store with these configurations and I will see if I can help get the totals correct.

    Just to confirm your configuration, you are using "show prices with tax" and "tax on shipping", correct?

    Let me know?

    Thanks,
    Jeff

  3. #13
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: tax calculation problem with coupons and multiple products

    The code now works in v1.3.7 so that the links are active and functional on the orders and the My Account history ...

    This may even have been fixed in v1.3.6 ... but I haven't had enough coffee yet to recall this ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #14
    Join Date
    Sep 2004
    Posts
    745
    Plugin Contributions
    4

    Default Re: tax calculation problem with coupons and multiple products

    Hi Ajeh,

    My peeve is not that it doesn't work... but that IMHO it is a bad idea to write html out to the order_total table records, as this makes any external database processor or editor fail since it will likely not expect to find html in ot records.

    Thanks,
    Jeff

  5. #15
    Join Date
    Nov 2003
    Location
    Haarlem | Netherlands
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: tax calculation problem with coupons and multiple products

    Quote Originally Posted by JeffD View Post
    Just to confirm your configuration, you are using "show prices with tax" and "tax on shipping", correct?
    Exactly.

    I already wondered why you added the fixes for including tax shops..

    If you are indeed willing to take a closer look at it I will be very gratefull :-)

  6. #16
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: tax calculation problem with coupons and multiple products

    If you look in the orders_total table you have a TEXT field of exactly what was contained and you have the class field for the Order Total Class example: ot_coupon used ...

    How is that any more or less helpful than a shipping module that adds text title:
    United States Postal Service (1 x 6.00lbs) (Bound Printed Material):
    vs the class field with ot_coupon and where the text title is:
    PHP Code:
    Discount Coupon: <a href="javascript:couponpopupWindow('http://www.my_domain.com/my_catalog/index.php?main_page=popup_coupon_help&amp;cID=1&amp;')">10OFFALL</a> : 
    What is it that would make having that stripped more helpful to you or how can you utilize it better?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #17
    Join Date
    Sep 2004
    Posts
    745
    Plugin Contributions
    4

    Default Re: tax calculation problem with coupons and multiple products

    Linda,

    The issues are order editors such as edit_orders or super_orders read this ot data back in from the database to allow order editing... for example, adding a coupon to an order which previously did not have a coupon (we have to do this dozens of times a week) or changing the coupon ID on an order that previously had a different coupon. Both EO and SO assume that directly after "Discount Coupon:" in the order totals table will be the coupon ID when in fact now there is a long html sequence before the code. This screws folks who install EO or SO and then attempt to edit existing orders which have a coupon (and have this extra html data), not to mention the fact that it makes querying for report data considerably more difficult since now you have to parse an html sequence in order to locate the coupon ID used on the order. I encourage you to install EO or SO and then attempt to edit a coupon order, or write an ot table query to return coupon codes used in the past month and I think you will quickly see how detrimental this extra data really is.

    Lately each new revision of ZC that we upgrade to we have to remember to edit ot_coupon.php to remove this extra data and in cases where we have forgotten we end up having to go back into the database later and hand edit dozens of database records containing the extra data, otherwise coupon orders can't be edited using these important contributions. It really gets to be a pain, trust me...

    Thanks for listening!
    Jeff

  8. #18
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: tax calculation problem with coupons and multiple products

    So kind of like when I added all those fields to make things easier for Super Orders I should of looked at a few more eh?

    Actually we are aware that there are quite a few fields that need cleaning up for the orders tables group so that you have both text and live info so things can be added as well as removed ...

    A lot of things get cleaned up with each release but we do not always know everything you feel that you need ... so the better answer on the Discount Coupon is two fields so you have text as well as real coupon coded ... you would know it was a ot_coupon from the class field and then could pop the code from something like a redeem field but that would have to be smart if we do grow to multiple Discount Coupons so you can get them all ...

    But yes, I can see what a royal pain that might be for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #19
    Join Date
    Nov 2003
    Location
    Haarlem | Netherlands
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: tax calculation problem with coupons and multiple products

    Hey Jeff,

    I got it working for freeshipping now too.

    Or at least working in my case, which is a shop using/showing prices including tax, for products as well as shipping.

    I am not sure if it will work correctly for everyone, but it does in my case (also did some tests on coupon value, order total and tax for percentage and fixed discounts).

    Since the shipping cost already includes tax (in my case), I fixed your fix to calculate the included tax (before it calculated the tax as if the shipping cost was ex tax):
    Code:
                // JTD:04/20/06 - added support to subtract coupon tax from tax total when shipping includes tax
                 if (DISPLAY_PRICE_WITH_TAX == 'true') {
                    $tax_rate = zen_get_tax_rate($this->tax_class, $tax_address['country_id'], $tax_address['zone_id']);
                    $tax_desc = zen_get_tax_description($this->tax_class, $tax_address['country_id'], $tax_address['zone_id']);
                    if ($tax_rate > 0) {
                      
                        // shipping tax if shipping_cost is excluding tax (possible here?)
                        //$shipping_tax = ($order->info['shipping_cost'] * $tax_rate)/100;
                        
                        // paulm shipping tax if shipping_cost is including tax:
                        $shipping_tax = $order->info['shipping_cost'] - ((100 * $order->info['shipping_cost'])/ (100 + $tax_rate));
                        
                        $od_amount['tax'] -= $shipping_tax;
                        $od_amount[$tax_desc]  += $shipping_tax; 
                                 
                        // paulm hack to fix double taxing with freeshipping coupons
                        $od_amount['total'] += $od_amount['tax'];
                      }
                    }              
                // JTD:04/20/06 - end of addition for support to subtract coupon tax from tax total when shipping includes tax

  10. #20
    Join Date
    Sep 2004
    Posts
    745
    Plugin Contributions
    4

    Default Re: tax calculation problem with coupons and multiple products

    Hi Paul,

    Well I tried you changes but at least on my store it produces incorrect results for tax, coupon amount and order total when a free shipping coupon is used. I suppose it is possible that I have the store I am testing on set up improperly since I usually don't use the "product price includes tax" or "tax on shipping" options so let me review my configuration and test data with you.

    I only have one tax class "Taxable Goods" which is 7.25% "Texas State Sales tax" so I am using this class for both product tax and shipping tax. Here is the Modules->Order Total->Discount Coupon configuration.

    Discount Coupon

    This module is installed
    true

    Sort Order
    280

    Include Shipping
    true

    Include Tax
    true

    Re-calculate Tax
    Standard

    Tax Class
    Taxable Goods

    I do not have the free shipping module installed as I don't believe it is needed to redeem a free shipping coupon but perhaps I am wrong about this or somehow inclusion of this module changes the calculations?

    Here is the pertinent info in Configuration->My Store

    Display Prices with Tax true
    Basis of Product Tax Shipping
    Basis of Shipping Tax Shipping

    To the best of my knowledge all other configuration is default.

    When I use my version of the code I get:

    Sub-Total: $10.71
    Discount Coupon: FSHIP : -$6.96
    Texas State Sales Tax: $0.72
    United States Postal Service (1 x 1.00lbs) (Priority Mail (2 - 3 days)): $6.49
    Total:$10.71

    Notice that everything is correct except the discount coupon amount which appears as $6.96 rather than $6.49, however the order total, and tax are correct as this is a $9.99 retail product price.

    When I attempt to use your code I get:

    Sub-Total:$10.71
    Discount Coupon: FSHIP : -$6.05
    Texas State Sales Tax: $0.32
    United States Postal Service (1 x 1.00lbs) (Priority Mail (2 - 3 days)): $6.49
    Total:$11.15

    The only correct amount in the above calculation is the Sub-Total. All other values are wrong. The coupon amount indicates the non-taxed value of the shipping, yet under shipping charges the $6.49 value is correct i.e., $6.05 + $0.44 tax = $6.49 and the slaes tax amount is off by $0.40 and the total by $0.44?

    Is it possible you have some different configuration settings than I am using?

    Thanks,
    Jeff

 

 
Page 2 of 6 FirstFirst 1234 ... LastLast

Similar Threads

  1. Problem with Tax calculation
    By ianhg in forum General Questions
    Replies: 7
    Last Post: 27 Apr 2009, 09:09 PM
  2. Problem with tax calculation on Tax Exempt goods
    By vickula in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 25 Mar 2009, 03:49 PM
  3. tax calculation error with coupons
    By poosk in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 22 Oct 2008, 02:35 PM
  4. Replies: 0
    Last Post: 13 Jun 2008, 12:57 PM
  5. Coupons and Tax calculation in Europe
    By cdelab in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 13 Jan 2008, 07:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR