Forums / Bug Reports / tax related bug in order.php class

tax related bug in order.php class

Views: 1,092

Results 1 to 1 of 1
9 Apr 2012, 10:34 AM
#1
j_vovus avatar

j_vovus

New Zenner

Join Date:
Apr 2012
Posts:
4
Plugin Contributions:
0

tax related bug in order.php class

ZenCart 1.5.0, fresh install.
Bug in order.php:523
http://zencart.svn.sourceforge.net/viewvc/zencart/branches/v1-5-0/trunk/includes/classes/order.php?revision=39&view=markup

      $totalTaxAdd = 0;
      foreach ($taxRates as $taxDescription=>$taxRate)
      {
        $taxAdd = 0;
        if ($taxDescription == $products_tax_description)
        {
          if (DISPLAY_PRICE_WITH_TAX == 'true')
          {
            $taxAdd = zen_round($shown_price / (100 + $this->products[$index]['tax']) * $this->products[$index]['tax'], $decimals);
          } else
          {
              $taxAdd = zen_calculate_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
                      +  zen_round(zen_calculate_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']), $decimals);
          }
          if (isset($this->info['tax_groups'][$taxDescription]))
          {
            $this->info['tax_groups'][$taxDescription] += $taxAdd;
          } else
          {
            $this->info['tax_groups'][$taxDescription] = $taxAdd;
          }
        }
        $totalTaxAdd += $taxAdd;
      }
      $this->info['tax'] += $totalTaxAdd;
      /*********************************************
       * END: Calculate taxes for this product
       *********************************************/
      $index++;
    }

E.g.: Tax for each product array('VAT' => 7.25, 'Charity' => 1)
Thus we have $products_tax_description = 'VAT + Charity', but $taxDescription can be only VAT or Charity each iteration, so $taxDescription == $products_tax_description is always false, when more than 1 Tax rate applicable.

Best regards,
Vladimir.