if ($module_name != 'shipping' && defined('MODULE_ORDER_TOTAL_' . strtoupper($module_name) . '_TAX_CLASS')) {
         $module_tax_class = constant('MODULE_ORDER_TOTAL_' . strtoupper($module_name) . '_TAX_CLASS');
     } else {
         $module_tmp_name = explode('_', $order->info['shipping_class']);
         // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
         $module_tmp_name = $module_tmp_name[0];
         if ($module_tmp_name != 'selfpickup' && $module_tmp_name != 'free' && defined('MODULE_SHIPPING_' . strtoupper($module_tmp_name) . '_TAX_CLASS')) {
             //DokuMan - 2011-05-18 - set 'freeamount' back to 'free' again
             $module_tax_class = constant('MODULE_SHIPPING_' . strtoupper($module_tmp_name) . '_TAX_CLASS');
         }
     }
     //echo $module_value['class'].'|'.$module_tax_class.'<br>'; //DEBUG
 } else {
     $module_tax_class = '0';
 }
 $c_info = get_c_infos($order->customer['ID'], trim($order->delivery['country_iso_2']));
 // web28 - 2012-04-05 - FIX orders tax
 $module_tax_rate = xtc_get_tax_rate($module_tax_class, $c_info['country_id'], $c_info['zone_id']);
 //echo $module_value['class'].'|'.$module_tax_rate.'<br>'; //DEBUG
 if ($status['customers_status_show_price_tax'] == 1) {
     $module_b_price = $module_value['value'];
     //BOF - Dokuman - 2010-03-17 - use module_tax_class here
     if ($module_tax_class == '0') {
         //if ($module_tax == '0') {
         //EOF - Dokuman - 2010-03-17 - use module_tax_class here
         $module_n_price = $module_value['value'];
     } else {
         $module_n_price = $xtPrice->xtcRemoveTax($module_b_price, $module_tax_rate);
     }
     $module_tax = $xtPrice->calcTax($module_n_price, $module_tax_rate);
     //echo 'MT1: '.$module_tax .'<br>'; //DEBUG
Пример #2
0
 /**
  * This function searchs the inividual price for a product using the product id $pID
  *
  * @param Integer $pID product id
  * @param Boolean $format Format the result?
  * @param Double $qty quantity
  * @param Integer $tax_class tax class id
  * @param Double $pPrice product price
  * @param Integer $vpeStatus vpe status
  * @param Integer $cedit_id customer specify tax conditions
  * @return String/Array Price (if format = true both plain and formatted)
  */
 function xtcGetPrice($pID, $format = true, $qty, $tax_class, $pPrice, $vpeStatus = 0, $cedit_id = 0)
 {
     // check if group is allowed to see prices
     if ($this->cStatus['customers_status_show_price'] == '0') {
         return $this->xtcShowNote($vpeStatus);
     }
     // get Tax rate
     if ($cedit_id != 0) {
         if (defined('HTTP_CATALOG_SERVER')) {
             global $order;
             // edit orders in admin guest account
             $cinfo = get_c_infos($order->customer['ID'], trim($order->delivery['country_iso_2']));
         } else {
             $cinfo = xtc_oe_customer_infos($cedit_id);
         }
         $products_tax = xtc_get_tax_rate($tax_class, $cinfo['country_id'], $cinfo['zone_id']);
     } else {
         $products_tax = isset($this->TAX[$tax_class]) ? $this->TAX[$tax_class] : 0;
     }
     if ($this->cStatus['customers_status_show_price_tax'] == '0') {
         $products_tax = '';
     }
     // add taxes
     if ($pPrice == 0) {
         $pPrice = $this->getPprice($pID);
     }
     $pPrice = $this->xtcAddTax($pPrice, $products_tax);
     // check specialprice
     if ($sPrice = $this->xtcCheckSpecial($pID)) {
         return $this->xtcFormatSpecial($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus);
     }
     // check graduated
     if ($this->cStatus['customers_status_graduated_prices'] == '1') {
         if ($sPrice = $this->xtcGetGraduatedPrice($pID, $qty)) {
             return $this->xtcFormatSpecialGraduated($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $tax_class);
         }
     } else {
         // check Group Price
         if ($sPrice = $this->xtcGetGroupPrice($pID, 1)) {
             return $this->xtcFormatSpecialGraduated($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $tax_class);
         }
     }
     // check Product Discount
     if ($discount = $this->xtcCheckDiscount($pID)) {
         return $this->xtcFormatSpecialDiscount($pID, $discount, $pPrice, $format, $vpeStatus);
     }
     return $this->xtcFormat($pPrice, $format, 0, false, $vpeStatus, $pID);
 }