Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jun 2012
    Posts
    452
    Plugin Contributions
    0

    Default Incorrect tax with Group Discount

    I'm having trouble with tax calculations for different products with group discounts. The store has taxable and non-taxable products as well as products that are discountable and non-discountable for group members. Thus I have four conditions to handle in ot_group_pricing.php: (1) taxable and discountable, (2) taxable and non-discountable, (3) non-taxable and discountable, and (4) non-taxable and non-discountable. I've modified ot_group_pricing.php to calculate the totals for each of the four conditions plus calculate total taxable and total non-taxable. The correct discount amount is calculated. A ratio used in tax calculations is defined as:
    Code:
    $ratio = $od_amount['total']/$order_total;
    in line 96 of the unmodified ot_group_pricing zc157c code. Later, $ratio is used in the following code:
    Code:
    case 'Standard':
              if ($od_amount['total'] >= $order_total) {
                $ratio = 1;
              }
              $adjustedTax = $orderTotalTax * $ratio;
              if ($order->info['tax'] == 0) return $od_amount;
              $ratioTax = ($orderTotalTax != 0 ) ? $adjustedTax/$orderTotalTax : 0;
              $tax_deduct = 0;
              foreach ($taxGroups as $key=>$value) {
                $od_amount['tax_groups'][$key] = $value * $ratioTax;
                $tax_deduct += $od_amount['tax_groups'][$key];
              }
              $od_amount['tax'] = $tax_deduct;
            break;
    I think the ratio calculation needs to be modified, but I'm stuck. In the calculation of $ratio, should $order_total be replaced by the order discountable taxable total, the order discountable total, or something else? What exactly is $ratio supposed to represent? Any changes needed in the standard case block? The tax calculated is incorrect when mixed discountable and non-discountable products exist in the order.

    Dave
    zc157c, php7.3, only one tax - state sales tax
    Last edited by Dave224; 23 Jun 2021 at 03:55 PM.

 

 

Similar Threads

  1. Sales Tax incorrect with percentage discount coupon
    By coryinit in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 8
    Last Post: 5 Apr 2010, 03:40 AM
  2. Replies: 18
    Last Post: 12 Mar 2010, 06:37 PM
  3. Replies: 0
    Last Post: 13 Jun 2008, 12:57 PM
  4. Discount Coupon AND Group Discount Tax Problem
    By mrkrinkle in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 11
    Last Post: 5 Apr 2007, 12:16 PM
  5. Order total incorrect with discount pricing group + tax
    By dbrewster in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 4
    Last Post: 14 Sep 2006, 03:13 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