Ejemplo n.º 1
0
 /**
  * calculates the total tax rate that is applied to a product from the applied
  * tax classes defined on the product.
  *
  * @param array $product_rates_array the product rates array
  * @return mixed null if no taxes or array is null, otherwise the total tax rate to apply
  */
 public static function calculate_total_tax_rate($product_rates_array)
 {
     $tax_rate = null;
     if ($product_rates_array && is_array($product_rates_array) && self::get_options()->get('jigoshop_calc_taxes') == 'yes' && !empty($product_rates_array)) {
         $tax_rate = 0;
         foreach ($product_rates_array as $tax_class => $value) {
             if (jigoshop_product::get_non_compounded_tax($tax_class, $product_rates_array)) {
                 $tax_rate += round(jigoshop_product::get_product_tax_rate($tax_class, $product_rates_array), 4);
             } else {
                 $tax_rate += round((100 + $tax_rate) * (jigoshop_product::get_product_tax_rate($tax_class, $product_rates_array) / 100), 4);
             }
         }
     }
     return $tax_rate;
 }