Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2007
    Posts
    260
    Plugin Contributions
    0

    Default Tax values are calculated wrong when adding products

    Some reason zen_get_tax_rate() calculates the tax wrong.
    It return 44 and not 22 on my products. It sums the two Tax Rate values (22%). What am I doing wrong?

    Example when adding a product.
    Tax Class: Taxable Goods
    Then when typing Products Price (Gross) value it auto calculates Products Price (Net) value using 44% tax and not 22%.



    HERE ARE MY TAX SETTINGS

    Zone Definitions
    1 Folder EEC VAT Zone European economic community for VAT [EU countries]
    2 Folder Finland Home country

    Tax Classes
    1 Taxable Goods

    Tax Rates
    1 Taxable Goods EEC VAT Zone 22%
    2 Taxable Goods Finland 22%

  2. #2
    Join Date
    Nov 2007
    Posts
    260
    Plugin Contributions
    0

    Default Re: Tax values are calculated wrong when adding products

    Then function zen_get_tax_rate(...) lookes like below.
    It is in ...admin\includes\functions\general.php file.

    I do not understand why function sum the tax rates?
    I could edit the function but not sure if it effect other code. I would presume there is a reason for the sum calculation.


    ...

    $tax = $db->Execute("select SUM(tax_rate) as tax_rate
    from (" . TABLE_TAX_RATES . " tr
    left join " . TABLE_ZONES_TO_GEO_ZONES . " za
    ON tr.tax_zone_id = za.geo_zone_id
    left join " . TABLE_GEO_ZONES . " tz ON tz.geo_zone_id = tr.tax_zone_id )
    WHERE (za.zone_country_id IS NULL
    OR za.zone_country_id = 0
    OR za.zone_country_id = '" . (int)$country_id . "')
    AND (za.zone_id IS NULL OR za.zone_id = 0
    OR za.zone_id = '" . (int)$zone_id . "')
    AND tr.tax_class_id = '" . (int)$class_id . "'
    GROUP BY tr.tax_priority");

    if ($tax->RecordCount() > 0) {
    $tax_multiplier = 0;
    while (!$tax->EOF) {
    $tax_multiplier += $tax->fields['tax_rate'];
    $tax->MoveNext();
    }
    return $tax_multiplier;
    } else {
    return 0;
    }
    Last edited by marksu; 13 Nov 2008 at 09:55 PM.

  3. #3
    Join Date
    Nov 2007
    Posts
    260
    Plugin Contributions
    0

    Default Re: Tax values are calculated wrong when adding products

    The example above to add new product seems to use other function not function zen_get_tax_rate(...) cause when I changed the function it still gave that same problem.

    Seems as a other module uses function zen_get_tax_rate(...) which also give false result. So maybe my settings are false?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Tax values are calculated wrong when adding products

    Quote Originally Posted by marksu View Post
    Some reason zen_get_tax_rate() calculates the tax wrong.
    It return 44 and not 22 on my products. It sums the two Tax Rate values (22%). What am I doing wrong?
    If you're referring to the Product Price Gross and Product Price Net fields in the admin when adding/editing a product, there's a known display bug in Zen Cart versions older than v1.3.8 that causes the values to show on-screen incorrectly.

    However, the bug is only on display in the admin. The correct calculation occurs on the shopping-cart side. Customers are charged the correct amount.

    Upgrading to v1.3.8 should solve the problem. Or, you could search the forum and find the posted solution for v1.3.7 a couple years ago.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Nov 2007
    Posts
    260
    Plugin Contributions
    0

    Default Re: Tax values are calculated wrong when adding products

    Quote Originally Posted by DrByte View Post
    If you're referring to the Product Price Gross and Product Price Net fields in the admin when adding/editing a product, there's a known display bug in Zen Cart versions older than v1.3.8 that causes the values to show on-screen incorrectly.

    However, the bug is only on display in the admin. The correct calculation occurs on the shopping-cart side. Customers are charged the correct amount.

    Upgrading to v1.3.8 should solve the problem. Or, you could search the forum and find the posted solution for v1.3.7 a couple years ago.
    Thank you for replying.
    Still my big question is that why zen_get_tax_rate(...) function is summing my tax values and giving false result. I have edited it so it does not do that anymore . Still wonder why it calculates that way. I would presume there is a reason for that.

    I am afraid that by editing the core function zen_get_tax_rate(...) some other problems could accure?

  6. #6
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Tax values are calculated wrong when adding products

    I believe zen_get_tax_rate was adjusted in 1.3.8 to specifically address that problem.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Nov 2007
    Posts
    260
    Plugin Contributions
    0

    Default Re: Tax values are calculated wrong when adding products

    Quote Originally Posted by DrByte View Post
    I believe zen_get_tax_rate was adjusted in 1.3.8 to specifically address that problem.

    OK maybe I shoudl dload that wercion and check the function.
    Thanks for the tip.

 

 

Similar Threads

  1. v150 Tax is wrong on products when discounts are used
    By ray-the-otter in forum Bug Reports
    Replies: 3
    Last Post: 19 Jun 2012, 02:14 PM
  2. Per Weight Shipping not Calculated when Tax is Calculated
    By CascianoLtd in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 28 Sep 2009, 04:29 AM
  3. Tax Calculated in Zen Cart but PayPal not adding in final order
    By hollyscents in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 27 Jan 2009, 08:14 PM
  4. change default values when adding products:
    By matteoraggi in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 2
    Last Post: 22 Dec 2007, 08:57 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