Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,537
    Plugin Contributions
    127

    Default Re: order quantity discount calculation

    OK. Try replacing process() in ot_quantity_discount.php with this:

    Code:
        function process() {
           global $db, $order, $currencies;
           $od_amount = $this->calculate_deductions();
           if ($od_amount['total'] > 0) {
             $show_amt = $od_amount['total'];
             reset($order->info['tax_groups']);
             while (list($key, $value) = each($order->info['tax_groups'])) {
               $tax_rate = zen_get_tax_rate_from_desc($key);
               if ($od_amount[$key]) {
                 $order->info['tax_groups'][$key] -= $od_amount[$key];
                 if (DISPLAY_PRICE_WITH_TAX == 'true') {
                    $show_amt += $od_amount[$key];
                    $tax_deduct = $od_amount[$key] - ($od_amount[$key] * $tax_rate/100);
                    $order->info['total'] -=  $tax_deduct;
                 } else {
                    $order->info['total'] -=  $od_amount[$key];
                 }
               }
             }
             $order->info['total'] = $order->info['total'] - $show_amt;
             $this->title = '<a href="javascript:alert(\'' . $this->explanation . '\');">' . $this->title . '</a>';
             $this->output[] = array('title' => $this->title . ':',
             'text' => '-' . $currencies->format($show_amt, true, $order->info['currency'], $order->info['currency_value']),
             'value' => $od_amount['total']);
           }
        }
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  2. #2
    Join Date
    Oct 2006
    Posts
    6
    Plugin Contributions
    0

    Default Re: order quantity discount calculation

    thanks for the reply
    seems you are sorta getting closer to the answer
    ok still the discount is a little off
    eg
    sub total 100
    disc. -10
    tax 10% 8.18
    total 89.18

    as you can see the total is still out not by much but the more you add the more it is out

    the tax seems to be calculating on the correct total amount of the total eg we work out the gst by total
    $90/11 =8.18
    90-8.18=81.82 exclusive
    81.82+10%=90inclusive
    thanks again for your time

    ps a quick explaination in the code so i know what why this is happening would be great unless it is more than just a couple of lines

 

 

Similar Threads

  1. Group discount minimum order quantity?
    By swamyg1 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 3
    Last Post: 29 Nov 2011, 12:11 AM
  2. Order Total Calculation Error (Group Discount)
    By Jace in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 3
    Last Post: 9 Mar 2011, 06:51 AM
  3. Order Total Calculation Error (Group Discount)
    By Jace in forum General Questions
    Replies: 4
    Last Post: 10 Dec 2010, 02:12 PM
  4. Replies: 18
    Last Post: 12 Mar 2010, 06:37 PM
  5. quantity discount calculation wrong
    By qingtianyu9 in forum General Questions
    Replies: 2
    Last Post: 19 Jul 2008, 05:05 AM

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