Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Posts
    6
    Plugin Contributions
    0

    Default order quantity discount calculation

    hi guys and gals
    Running zc 1.3.6
    Installed order quantity mod which seems to work fine untill you manually add the totals up and relize it dont add up correctly
    eg
    Sub total $81.45 correct
    shippin: $12.10 correct
    discount -$8.14 correct
    tax @10% $7.69 correct
    total $84.60 incorrect when you add this up it should be $85.41

    my settings are
    uantity Discount
    This module is installed - version 1.3
    true
    Sort Order
    295
    Include Tax
    true
    Re-calculate Tax
    Standard
    Discount Units
    percentage
    Discount Basis
    Total Items in Cart
    Discount Level 1
    5
    Discount Amount 1
    10

    Now if I change recalulate tax to "none" this changes my total to correct amount but obviously leaves my tax at original calculated amount
    Sub total $81.45 correct
    shippin: $12.10 correct
    discount -$8.14 correct
    tax @10% $8.50 correct
    total $85.41
    any ideas
    thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,684
    Plugin Contributions
    123

    Default Re: order quantity discount calculation

    I can't dup this. Using your settings, I get the right numbers.

    Do you display prices with taxes included? Any other non-US style
    settings I may not have tested?

    Scott
    Attached Images Attached Images  
    That Software Guy. My Store: Zen Cart Modifications
    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.

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

    Default Re: order quantity discount calculation

    I do display prices including tax
    Have only one tax setup in one zone which is 10%


    Arhhh just spotted wats happening!! not that i know how to fix it but you guys might.
    It seems that when i choose to recalulate tax (which is 10%) its adding 10% to the discount price even though it doesnt show it then taking that figure off thoe total price.
    EG
    $362.00
    Sub-Total:


    $12.10
    Flat Rate (Best Way):


    -$36.19 if you were to add 10% here $39.80 so 362+12.10-39.80= 334.30

    Quantity Discount:


    $30.39
    GST 10%:


    $334.29 this should be 337.91

    Total:

    Hope this is explained ok
    Also i have another zen cart setup and i just installed this mod there and it does the same thing??
    Thanx in advanced
    Michael

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,684
    Plugin Contributions
    123

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

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

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