function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes, $xtPrice;
     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
         $order_total = $xtPrice->xtcRemoveCurr($_SESSION['cart']->show_total());
     } else {
         $order_total = $shipping_weight;
     }
     $table_cost = preg_split("/[:,]/", MODULE_SHIPPING_TABLE_COST);
     // Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
     $size = sizeof($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($order_total <= $table_cost[$i]) {
             $shipping = $table_cost[$i + 1];
             break;
         }
     }
     if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_TABLE_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
 function quote($method = '')
 {
     global $order, $total_count;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY, 'cost' => MODULE_SHIPPING_ITEM_COST * $total_count + MODULE_SHIPPING_ITEM_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
 function process()
 {
     global $order, $xtPrice;
     //include needed functions
     require_once DIR_FS_INC . 'xtc_calculate_tax.inc.php';
     if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
         switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
             $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax_description = xtc_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                 $order->info['tax'] += xtc_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $order->info['tax_groups'][TAX_ADD_TAX . "{$tax_description}"] += xtc_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + xtc_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $low_order_fee = xtc_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
             }
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
                 $order->info['tax'] += xtc_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $order->info['tax_groups'][TAX_NO_TAX . "{$tax_description}"] += xtc_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $order->info['subtotal'] += $low_order_fee;
                 $order->info['total'] += $low_order_fee;
             }
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] != 1) {
                 $low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
                 $order->info['subtotal'] += $low_order_fee;
                 $order->info['total'] += $low_order_fee;
             }
             $this->output[] = array('title' => $this->title . ':', 'text' => $xtPrice->xtcFormat($low_order_fee, true), 'value' => $low_order_fee);
         }
     }
 }
/**
 * Retrieve the shipping tax rate
 * 
 * @return float 
 */
function getShippingTaxRate()
{
    global $order;
    $shipping_class_array = explode("_", $order['shipping_class']);
    $shipping_class = strtoupper($shipping_class_array[0]);
    if (empty($shipping_class)) {
        $shipping_tax_rate = 0;
    } else {
        $const = 'MODULE_SHIPPING_' . $shipping_class . '_TAX_CLASS';
        if (defined($const)) {
            $shipping_tax_rate = xtc_get_tax_rate(constant($const));
        } else {
            $shipping_tax_rate = 0;
        }
    }
    return $shipping_tax_rate;
}
function product_to_EMOSItem($product, $lang, $quant, $cedit_id = 0)
{
    require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
    require_once DIR_FS_CATALOG . 'includes/classes/xtcPrice.php';
    $product_to_emos_query = xtc_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int) $product . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $lang . "'");
    $product_to_emos = xtc_db_fetch_array($product_to_emos_query);
    $emos_xtPrice = new xtcPrice(DEFAULT_CURRENCY, $_SESSION['customers_status']['customers_status_id']);
    $product_to_emos_price = $emos_xtPrice->xtcGetPrice($product_to_emos['products_id'], false, $quant, $product_to_emos['products_tax_class_id'], $product_to_emos['products_price'], '', $cedit_id);
    if (ECONDA_PRICE_IS_BRUTTO == 'false') {
        $product_to_emos_price = sprintf("%0.2f", $product_to_emos_price / ((xtc_get_tax_rate($product_to_emos['products_tax_class_id']) + 100) / 100));
    }
    $item = new EMOS_Item();
    $item->productID = $product_to_emos['products_id'];
    $item->productName = $product_to_emos['products_name'];
    $item->price = $product_to_emos_price;
    $item->productGroup = product_path_by_name((int) $product, (int) $lang) . "/" . $product_to_emos['products_name'];
    $item->quantity = (int) $quant;
    return $item;
}
 function quote()
 {
     global $order, $shipping_weight;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_CHRONOPOST_TEXT_TITLE, 'methods' => array());
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     for ($i = 1; $i <= $this->num_chronopost; $i++) {
         $countries_table = constant('MODULE_SHIPPING_CHRONOPOST_COUNTRIES_' . $i);
         $country = explode(",", $countries_table);
         // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
         if (in_array($dest_country, $country)) {
             $dest_zone = $i;
             break;
         }
     }
     if ($dest_zone == 0) {
         $this->quotes['error'] = MODULE_SHIPPING_CHRONOPOST_INVALID_ZONE;
         return $this->quotes;
     }
     $table = preg_split("/[:,]/", constant('MODULE_SHIPPING_CHRONOPOST_COST_' . $dest_zone));
     // Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
     $cost = -1;
     for ($i = 0, $n = sizeof($table); $i < $n; $i += 2) {
         if ($shipping_weight <= $table[$i]) {
             $cost = $table[$i + 1] + MODULE_SHIPPING_CHRONOPOST_HANDLING + SHIPPING_HANDLING;
             break;
         }
     }
     if ($cost == -1) {
         $this->quotes['error'] = MODULE_SHIPPING_CHRONOPOST_UNDEFINED_RATE;
         return $this->quotes;
     }
     $this->quotes['methods'][] = array('id' => $this->code, 'title' => MODULE_SHIPPING_CHRONOPOST_TEXT_WAY . ' ' . $order->delivery['country']['title'], 'cost' => $cost + MODULE_SHIPPING_CHRONOPOST_HANDLING + SHIPPING_HANDLING);
     return $this->quotes;
 }
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     $gew = 0;
     foreach ($order->products as $prod) {
         $gew += (double) $prod['weight'] * $prod['qty'];
     }
     if ($order->delivery['country']['iso_code_2'] == 'DE') {
         $preise = preg_split("/;/", MODULE_SHIPPING_HERMES_NATIONAL);
     } else {
         $preise = preg_split("/;/", MODULE_SHIPPING_HERMES_INTERNATIONAL);
     }
     // Hetfield - 2009-11-19 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
     $gewichte = preg_split("/;/", MODULE_SHIPPING_HERMES_GEWICHT);
     // Hetfield - 2009-11-19 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
     $price_id = 0;
     foreach ($gewichte as $g) {
         if ($gew <= $g) {
             break;
         }
         $price_id++;
     }
     if ($order->delivery['country']['iso_code_2'] == 'DE') {
         $stitle = MODULE_SHIPPING_HERMES_TEXT_WAY_DE . $shipping_num_boxes * $shipping_weight . ' ' . MODULE_SHIPPING_HERMES_TEXT_UNITS;
     } else {
         $stitle = MODULE_SHIPPING_HERMES_TEXT_WAY_EU . $shipping_num_boxes * $shipping_weight . ' ' . MODULE_SHIPPING_HERMES_TEXT_UNITS;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_HERMES_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $stitle, 'cost' => $preise[$price_id])));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
 /**
  * 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);
 }
function showSpecialsBox()
{
    global $pInfo;
    //web28 - 2010-07-27 - show products_price
    // include localized categories specials strings
    require_once DIR_FS_LANGUAGES . $_SESSION['language'] . '/admin/categories_specials.php';
    //BOF web28 - 2010-07-27 - show products_price
    if (PRICE_IS_BRUTTO == 'true') {
        $products_price_sp = xtc_round($pInfo->products_price * ((100 + xtc_get_tax_rate($pInfo->products_tax_class_id)) / 100), PRICE_PRECISION);
        $products_price_netto_sp = TEXT_NETTO . '<strong>' . $pInfo->products_price * (xtc_get_tax_rate($sInfo->products_tax_class_id) + 100) / 100 . '</strong>  ';
    } else {
        $products_price_sp = xtc_round($pInfo->products_price, PRICE_PRECISION);
        $products_price_netto_sp = '';
    }
    //EOF web28 - 2010-07-27 - show products_price
    // if editing an existing product
    if (isset($_GET['pID'])) {
        $specials_query = "SELECT p.products_tax_class_id,\n                                p.products_id,\n                                p.products_price,\n                                pd.products_name,\n                                s.specials_id,\n                                s.specials_quantity,\n                                s.specials_new_products_price,\n                                s.specials_date_added,\n                                s.specials_last_modified,\n                                s.expires_date,\n                                s.status\n                           FROM " . TABLE_PRODUCTS . " p,\n                                " . TABLE_PRODUCTS_DESCRIPTION . " pd,\n                                " . TABLE_SPECIALS . " s\n                          WHERE p.products_id = pd.products_id\n                            AND pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n                            AND p.products_id = s.products_id\n                            AND s.products_id = '" . (int) $_GET['pID'] . "'";
        //DokuMan - 2011-11-8 - added missing s.status from SP1b
        $specials_query = xtDBquery($specials_query);
        // if there exists already a special for this product
        if (xtc_db_num_rows($specials_query, true) > 0) {
            $special = xtc_db_fetch_array($specials_query, true);
            $sInfo = new objectInfo($special);
        }
    }
    $price = $sInfo->products_price;
    $new_price = $sInfo->specials_new_products_price;
    $new_price_netto = '';
    //web28 - 2010-07-27 - show special_price netto
    if (PRICE_IS_BRUTTO == 'true') {
        $price_netto = xtc_round($price, PRICE_PRECISION);
        if ($price > 0) {
            $new_price_netto = TEXT_NETTO . '<strong>' . xtc_round($new_price, PRICE_PRECISION) . '</strong>';
            //web28 - 2010-07-27 - show special_price netto
        }
        $price = $price * (xtc_get_tax_rate($sInfo->products_tax_class_id) + 100) / 100;
        $new_price = $new_price * (xtc_get_tax_rate($sInfo->products_tax_class_id) + 100) / 100;
    }
    $price = xtc_round($price, PRICE_PRECISION);
    $new_price = xtc_round($new_price, PRICE_PRECISION);
    // build the expires date in the format YYYY-MM-DD
    if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0 and $sInfo->expires_date != 0) {
        $expires_date = substr($sInfo->expires_date, 0, 4) . "-" . substr($sInfo->expires_date, 5, 2) . "-" . substr($sInfo->expires_date, 8, 2);
    } else {
        $expires_date = "";
    }
    if ($sInfo->status == 1) {
        $status = 'checked="checked"';
    } else {
        $status = '';
    }
    // tell the storing script if to update existing special,
    // or to insert a new one
    echo xtc_draw_hidden_field('specials_action', isset($_GET['pID']) && xtc_db_num_rows($specials_query, true) > 0 ? "update" : "insert");
    echo xtc_draw_hidden_field('tax_rate', xtc_get_tax_rate($pInfo->products_tax_class_id));
    //web28 - 2010-07-27 - add hidden field
    echo xtc_draw_hidden_field('products_price_hidden', $pInfo->products_price);
    //web28 - 2010-07-27 - FIX wrong specials price
    if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0) {
        echo xtc_draw_hidden_field('specials_id', $sInfo->specials_id);
    }
    ?>

<script type="text/javascript">
  var specialExpires = new ctlSpiffyCalendarBox("specialExpires", "new_product", "specials_expires","btnDate2","<?php 
    echo $expires_date;
    ?>
",2);
</script>
<script language="JavaScript" type="text/JavaScript">
  function showSpecial() {
    //alert(document.getElementById("special").style.display);
  if (document.getElementById("special").style.display =="none" || document.getElementById("special").style.display =="") {
    document.getElementById("special").style.display="block";
    document.getElementById('butSpecial').innerHTML= '<a href="JavaScript:showSpecial()" class="btn btn-default">&laquo; Sonderangebot</a>';
  } else {
    document.getElementById("special").style.display="none";
    document.getElementById('butSpecial').innerHTML= '<a href="JavaScript:showSpecial()" class="btn btn-default">Sonderangebot &raquo;</a>';
    }
  }
</script>
<style type='text/css'>#special{display: none;}</style>
<noscript>
<style type="text/css">#special{display: block;}</style>
</noscript>
  <div id="special">
    <div style="padding: 8px 0px 3px 5px;">
          <div class="main">
            <strong><?php 
    echo SPECIALS_TITLE;
    ?>
</strong>
          </div>
    </div>
    <div class='col-xs-12' style="width: 100%; border: 1px solid; border-color: #aaaaaa; padding:5px; background-color: #f3f3f3;">   
            <?php 
    if (!isset($_GET['pID'])) {
        ?>
            <div class="col-xs-12 col-sm-9 col-md-5 col-lg-5">
              <div class="main col-xs-12 col-sm-4"><?php 
        echo TEXT_SPECIALS_NO_PID;
        ?>
</div>             
            </div>
            <div class='clearfix' ></div>
            <?php 
    } else {
        ?>
            <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5 ">
              <div class="main col-xs-12 col-sm-4"><?php 
        echo TEXT_PRODUCTS_PRICE;
        ?>
</div>
              <div class="main col-xs-12 col-sm-4"><?php 
        echo $products_price_sp;
        echo $products_price_netto_sp;
        ?>
</div>
            </div>   
            <div class='clearfix' ></div>
            <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5">
              <div class="main col-xs-12 col-sm-4" >
                <?php 
        echo TEXT_SPECIALS_SPECIAL_PRICE;
        ?>
              </div>
              <div class="main col-xs-12 col-sm-4" >
                <?php 
        echo xtc_draw_input_field('specials_price', $new_price, 'style="width: 135px"') . '&nbsp;&nbsp;&nbsp;' . $new_price_netto;
        ?>
              </div>
              <div class="main col-xs-12 col-sm-4" >
                <?php 
        if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0) {
            ?>
                <input type="checkbox" name="specials_delete" value="true" id="input_specials_delete"  onclick="if(this.checked==true)return confirm('<?php 
            echo TEXT_INFO_DELETE_INTRO;
            ?>
');"style="vertical-align:middle;"/><label for="input_specials_delete">&nbsp;<?php 
            echo TEXT_INFO_HEADING_DELETE_SPECIALS;
            ?>
</label>
                <?php 
        }
        ?>
              </div>
            </div>
            <div class='clearfix' ></div>
            <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5">
              <div class="main col-xs-12 col-sm-4">
                <?php 
        echo TEXT_SPECIALS_SPECIAL_QUANTITY;
        ?>
&nbsp;
              </div>
              <div class="main col-xs-12 col-sm-4">
                <?php 
        echo xtc_draw_input_field('specials_quantity', $sInfo->specials_quantity, 'style="width: 135px"');
        ?>
              </div>
            </div>
            <div class='clearfix' ></div>
            <?php 
        if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0) {
            ?>
              <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5">
                <div class="main col-xs-12 col-sm-4"><?php 
            echo TEXT_INFO_DATE_ADDED;
            ?>
</div>
                <div class="main col-xs-12 col-sm-4"><?php 
            echo xtc_date_short($sInfo->specials_date_added);
            ?>
</div>
                <div class="main col-xs-12 col-sm-4">&nbsp;</div>
              </div>
            <div class='clearfix' ></div>
              <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5">
                <div class="main col-xs-12 col-sm-4"><?php 
            echo TEXT_INFO_LAST_MODIFIED;
            ?>
</div>
                <div class="main col-xs-12 col-sm-4"><?php 
            echo xtc_date_short($sInfo->specials_last_modified);
            ?>
</div>
                <div class="main col-xs-12 col-sm-4">&nbsp;</div>
              </div>
            <div class='clearfix' ></div>
            <?php 
        }
        ?>
            <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5"> 
              <div class="main col-xs-12 col-sm-4">
                <?php 
        echo TEXT_SPECIALS_EXPIRES_DATE;
        ?>
              </div>
              <div class="main col-xs-12 col-sm-4">
                <script type="text/javascript">specialExpires.writeControl(); specialExpires.dateFormat="yyyy-MM-dd";</script>
                <noscript>
                <?php 
        echo xtc_draw_input_field('specials_expires', $expires_date, 'style="width: 135px"');
        ?>
                </noscript>
              </div>
              <div class="main col-xs-12 col-sm-4">
                <?php 
        if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0) {
            ?>
                <input type="checkbox" name="specials_status" value="1" id="input_specials_status"  style="vertical-align:middle;" <?php 
            echo $status;
            ?>
/><label for="input_specials_status">&nbsp;<?php 
            echo TEXT_EDIT_STATUS;
            ?>
</label>
                <?php 
        }
        ?>
              </div>
            </div>
            <div class='clearfix' ></div>
            <div class="col-xs-12">
              <div class="main" style="padding:3px; background: #D8D8D8;">
                <?php 
        echo TEXT_SPECIALS_PRICE_TIP;
        ?>
              </div>
            </div>
            <?php 
    }
    ?>
    </div>
  </div>
<?php 
}
    echo TABLE_HEADING_ACTION;
    ?>
&nbsp;</td>
              </tr>
<?php 
    $specials_query_raw = "select p.products_id, pd.products_name,p.products_tax_class_id, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "' and p.products_id = s.products_id order by pd.products_name";
    $specials_split = new splitPageResults($_GET['page'], '20', $specials_query_raw, $specials_query_numrows);
    $specials_query = xtc_db_query($specials_query_raw);
    while ($specials = xtc_db_fetch_array($specials_query)) {
        $price = $specials['products_price'];
        $new_price = $specials['specials_new_products_price'];
        if (PRICE_IS_BRUTTO == 'true') {
            $price_netto = xtc_round($price, PRICE_PRECISION);
            $new_price_netto = xtc_round($new_price, PRICE_PRECISION);
            $price = $price * (xtc_get_tax_rate($specials['products_tax_class_id']) + 100) / 100;
            $new_price = $new_price * (xtc_get_tax_rate($specials['products_tax_class_id']) + 100) / 100;
        }
        $specials['products_price'] = xtc_round($price, PRICE_PRECISION);
        $specials['specials_new_products_price'] = xtc_round($new_price, PRICE_PRECISION);
        if ((!$_GET['sID'] || $_GET['sID'] == $specials['specials_id']) && !$sInfo) {
            $products_query = xtc_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $specials['products_id'] . "'");
            $products = xtc_db_fetch_array($products_query);
            $sInfo_array = xtc_array_merge($specials, $products);
            $sInfo = new objectInfo($sInfo_array);
            $sInfo->specials_new_products_price = $specials['specials_new_products_price'];
            $sInfo->products_price = $specials['products_price'];
        }
        if (is_object($sInfo) && $specials['specials_id'] == $sInfo->specials_id) {
            echo '                  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'pointer\'" onclick="document.location.href=\'' . xtc_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '\'">' . "\n";
        } else {
            echo '                  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'pointer\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . xtc_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $specials['specials_id']) . '\'">' . "\n";
    $total = 0;
    $totalTax = 0;
    getTotalsOrderProducts($order_id);
    $params['transactionId'] = $billsafe_orders['transactionid'];
    $params['articleList'] = $articleList;
    $params['order_amount'] = number_format($total, 2, '.', '');
    $params['order_taxAmount'] = number_format($totalTax, 2, '.', '');
    $params['order_currencyCode'] = $currency;
    $response = $bs->callMethod('updateArticleList', $params);
    getBillSAFEresp($response, MODULE_PAYMENT_BILLSAFE_2_MESSAGE_PSTORNO, 'updateArticleListStornoPart', 'storno', $orderIDArr, $order_id, $billsafe_orders['id']);
} elseif (isset($_POST['updateArticleListVoucher'])) {
    $params['transactionId'] = $billsafe_orders['transactionid'];
    $counter = 0;
    $voucherAmount = $_POST['voucherAmount'];
    $voucherAmountKomma = $_POST['voucherAmountKomma'];
    $voucher_tax_rate = xtc_get_tax_rate($_POST['voucherTax']);
    if ($voucherAmount == '') {
        $voucherAmount = 0;
    }
    if ($voucherAmountKomma == '') {
        $voucherAmountKomma = 0;
    }
    $amount = '-' . $voucherAmount . '.' . $voucherAmountKomma;
    $total = 0;
    $totalTax = 0;
    getTotalsOrderProducts($order_id);
    if ($total + $amount >= 0) {
        $queryVoucher = xtc_db_query('SELECT * FROM billsafe_orders_details_2 WHERE articlenumber LIKE "backend-voucher-%"');
        $countVoucher = xtc_db_num_rows($queryVoucher);
        xtc_db_query('INSERT INTO billsafe_orders_details_2 (ordernumber, articletype, articlenumber, articlename, articleprice, articletax, bsorders_id) VALUES ("' . xtc_db_input($order_id) . '", "voucher", "backend-voucher-' . ($countVoucher + 1) . '", "' . MODULE_PAYMENT_BILLSAFE_2_UPDATEARTICLELISTVOUCHER . '-' . ($countVoucher + 1) . '", "' . xtc_db_input($amount) . '", "' . xtc_db_input($voucher_tax_rate) . '", "' . xtc_db_input($billsafe_orders['id']) . '");');
        get_bsod($order_id);
 /**
  * Calculate order total and save it away.
  *
  * We need to access to all additional charges, ie the order_totals list, in
  * the before_process() function but at that point order_totals->process
  * hasn't been run.
  *
  * @return array order_total_array
  */
 public function getOrderTotal()
 {
     global $order_total_modules, $order;
     $klarna_ot = $_SESSION['klarna_ot'];
     $shipping = $_SESSION['shipping'];
     $orderTotalModules = $order_total_modules->modules;
     $klarnaOrderTotals = array();
     if (!is_array($orderTotalModules)) {
         return $klarnaOrderTotals;
     }
     $ignore = array('ot_tax', 'ot_subtotal', 'ot_total', 'ot_subtotal_no_tax');
     $showTax = KlarnaConstant::showPriceTax();
     foreach ($orderTotalModules as $value) {
         $className = substr($value, 0, strrpos($value, '.'));
         $class = $GLOBALS[$className];
         // If the module class isn't an object, move along
         if (!is_object($class)) {
             continue;
         }
         // It this module isn't enabled, move along.
         if (!$class->enabled) {
             continue;
         }
         // Check if the module should be ignored. This is so that we don't add
         // the sub_total, order_total and tax_total to our goods list
         if (in_array($class->code, $ignore)) {
             continue;
         }
         $output = $class->output;
         if (sizeof($output) == 0) {
             continue;
         }
         $taxClass = null;
         foreach ($class->keys() as $constant) {
             if (strlen(strstr($constant, "TAX_CLASS")) > 0) {
                 if (defined($constant)) {
                     $taxClass = constant($constant);
                     continue;
                 }
             }
         }
         $taxRate = 0;
         $delCountryId = $order->delivery['country']['id'];
         $delZoneId = $order->delivery['zone_id'] > 0 ? $order->delivery['zone_id'] : null;
         if ($taxClass !== null) {
             $taxRate = xtc_get_tax_rate($taxClass, $delCountryId, $delZoneId);
         }
         foreach ($output as $orderTotal) {
             $orderTotal["rate"] = $taxRate;
             $klarnaOrderTotals[$className] = $orderTotal;
         }
         //Set Shipping VAT
         if ($className == 'ot_shipping') {
             $taxRate = $this->_getShippingTaxRate($shipping["id"]);
             $klarnaOrderTotals[$className]["rate"] = $taxRate;
         }
         $tax = 0;
         $value = $klarnaOrderTotals[$className]["value"];
         if ($showTax === false) {
             $tax = xtc_add_tax($value, $taxRate) - $value;
         } else {
             $tax = $value - $value / (1 + $taxRate / 100);
         }
         $klarnaOrderTotals[$className]["tax"] = $tax;
     }
     return $klarnaOrderTotals;
 }
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = '<?xml version="1.0" encoding="' . CHARSET . '"?>' . "\n" . '<doc>' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,\n                             p.products_image,\n                             p.products_price,\n                             p.products_status,\n                             p.products_quantity,\n                             p.products_shippingtime,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = strip_tags($products['products_description']);
         $products_description = substr($products_description, 0, 197) . '..';
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         $categorie_query = xtc_db_query("SELECT\n                                            categories_name\n                                            FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n                                            WHERE categories_id='" . $categories . "'\n                                            and language_id='" . $_SESSION['languages_id'] . "'");
         $categorie_data = xtc_db_fetch_array($categorie_query);
         $tax_rate = xtc_get_tax_rate($products['products_tax_class_id']);
         //create content
         $schema .= '<product>' . "\n";
         $schema .= '<group>' . $categorie_data['categories_name'] . '</group>' . "\n";
         $schema .= '<pid>' . $products['products_model'] . '</pid>' . "\n";
         $schema .= '<name>' . $products['products_name'] . '</name>' . "\n";
         $schema .= '<manufacturer>' . $products['manufacturers_name'] . '</manufacturer>' . "\n";
         $schema .= '<description>' . $products_description . '</description>' . "\n";
         $schema .= '<ean></ean>' . "\n";
         $schema .= '<prices>' . "\n";
         $schema .= '<price>' . "\n";
         $schema .= '<currency>' . $_POST['currencies'] . '</currency>' . "\n";
         $schema .= '<extax>' . number_format($products_price / ($tax_rate + 100) * 100, 2, '.', '') . '</extax>' . "\n";
         $schema .= '<inctax>' . number_format($products_price, 2, '.', '') . '</inctax>' . "\n";
         $schema .= '</price>' . "\n";
         $schema .= '</prices>' . "\n";
         $schema .= '<availability>' . $products['products_quantity'] . '</availability>' . "\n";
         $schema .= '<url>' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . '</url>' . "\n";
         $schema .= '</product>' . "\n";
     }
     $schema .= '</doc>' . "\n";
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
Beispiel #14
0
 /**
  * class methods
  */
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;
     for ($j = 1; $j <= $this->num_chp; $j++) {
         $countries_table = constant('MODULE_SHIPPING_CHP_COUNTRIES_' . $j);
         $country_zones = explode(",", $countries_table);
         // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
         if (in_array($dest_country, $country_zones)) {
             $dest_zone = $j;
             break;
         }
     }
     if ($dest_zone == 0) {
         $error = true;
     } else {
         $shipping = -1;
         $chp_cost_eco = @constant('MODULE_SHIPPING_CHP_COST_ECO_' . $j);
         $chp_cost_pri = @constant('MODULE_SHIPPING_CHP_COST_PRI_' . $j);
         $chp_cost_urg = @constant('MODULE_SHIPPING_CHP_COST_URG_' . $j);
         $methods = array();
         if ($chp_cost_eco != '') {
             $chp_table_eco = preg_split("/[:,]/", $chp_cost_eco);
             // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
             for ($i = 0; $i < sizeof($chp_table_eco); $i += 2) {
                 if ($shipping_weight <= $chp_table_eco[$i]) {
                     $shipping_eco = $chp_table_eco[$i + 1];
                     break;
                 }
             }
             if ($shipping_eco == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_CHP_UNDEFINED_RATE;
             } else {
                 $shipping_cost_1 = $shipping_eco + MODULE_SHIPPING_CHP_HANDLING;
             }
             if ($shipping_eco != 0) {
                 $methods[] = array('id' => 'ECO', 'title' => 'Economy', 'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
             }
         }
         if ($chp_cost_pri != '') {
             $chp_table_pri = preg_split("/[:,]/", $chp_cost_pri);
             // Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
             for ($i = 0; $i < sizeof($chp_table_pri); $i += 2) {
                 if ($shipping_weight <= $chp_table_pri[$i]) {
                     $shipping_pri = $chp_table_pri[$i + 1];
                     break;
                 }
             }
             if ($shipping_pri == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_CHP_UNDEFINED_RATE;
             } else {
                 $shipping_cost_2 = $shipping_pri + MODULE_SHIPPING_CHP_HANDLING;
             }
             if ($shipping_pri != 0) {
                 $methods[] = array('id' => 'PRI', 'title' => 'Priority', 'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
             }
         }
         if ($chp_cost_urg != '') {
             $chp_table_urg = preg_split("/[:,]/", $chp_cost_urg);
             // Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
             for ($i = 0; $i < sizeof($chp_table_urg); $i += 2) {
                 if ($shipping_weight <= $chp_table_urg[$i]) {
                     $shipping_urg = $chp_table_urg[$i + 1];
                     break;
                 }
             }
             if ($shipping_urg == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_CHP_UNDEFINED_RATE;
             } else {
                 $shipping_cost_3 = $shipping_urg + MODULE_SHIPPING_CHP_HANDLING;
             }
             if ($shipping_urg != 0) {
                 $methods[] = array('id' => 'URG', 'title' => 'Urgent', 'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_3) * $shipping_num_boxes);
             }
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => $this->title . ' ' . $dest_country . ' : ' . $shipping_num_boxes * $shipping_weight . ' ' . MODULE_SHIPPING_CHP_TEXT_UNITS . ')');
     $this->quotes['methods'] = $methods;
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     if ($error == true) {
         $this->quotes['error'] = MODULE_SHIPPING_CHP_INVALID_ZONE;
     }
     if (xtc_not_null($method) && isset($this->types[$method])) {
         for ($i = 0; $i < sizeof($methods); $i++) {
             if ($method == $methods[$i]['id']) {
                 $methodsc = array();
                 $methodsc[] = array('id' => $methods[$i]['id'], 'title' => $methods[$i]['title'], 'cost' => $methods[$i]['cost']);
                 break;
             }
         }
         $this->quotes['methods'] = $methodsc;
     }
     return $this->quotes;
 }
function shopGetTaxRate($class_id)
{
    return xtc_get_tax_rate($class_id);
}
 function get_shipping_tax_rate($shipping_id)
 {
     $check_query = xtc_db_query('SELECT configuration_value FROM ' . TABLE_CONFIGURATION . ' WHERE configuration_key = "MODULE_SHIPPING_' . $shipping_id . '_TAX_CLASS"');
     $configuration = xtc_db_fetch_array($check_query);
     $tax_class_id = $configuration['configuration_value'];
     $shipping_tax_rate = xtc_get_tax_rate($tax_class_id);
     return $shipping_tax_rate;
 }
 function xtc_order_total()
 {
     global $order;
     $this->amounts['total'] = 0;
     $order_total = $order->info['total'];
     // Check if gift voucher is in cart and adjust total
     $products = $_SESSION['cart']->get_products();
     for ($i = 0; $i < sizeof($products); $i++) {
         $t_prid = xtc_get_prid($products[$i]['id']);
         $gv_query = xtc_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");
         $gv_result = xtc_db_fetch_array($gv_query);
         $qty = $_SESSION['cart']->get_quantity($products[$i]['id']);
         $products_tax = xtc_get_tax_rate($gv_result['products_tax_class_id']);
         if (!isset($this->amounts[(string) $products_tax])) {
             $this->amounts[(string) $products_tax] = 0;
         }
         if (substr($gv_result['products_model'], 0, 4) == 'GIFT') {
             if ($this->include_tax == 'false') {
                 $gv_amount = $gv_result['products_price'] * $qty;
             } else {
                 $gv_amount = ($gv_result['products_price'] + xtc_calculate_tax($gv_result['products_price'], $products_tax)) * $qty;
             }
             $order_total -= $gv_amount;
         } else {
             $this->amounts[(string) $products_tax] += $gv_result['products_price'] * (int) $qty;
             $this->amounts['total'] += $gv_result['products_price'] * $qty;
         }
     }
     if ($this->include_shipping == 'false') {
         $order_total -= $order->info['shipping_cost'];
     }
     if ($this->include_tax == 'false') {
         $order_total -= $order->info['tax'];
     }
     $this->amount = $order_total;
 }
 function process()
 {
     global $order, $xtPrice, $free_shipping, $free_shipping_value_over;
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 $free_shipping_value_over = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 $free_shipping_value_over = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER_INTERNATIONAL;
                 break;
             case 'both':
                 if ($order->delivery['country_id'] == STORE_COUNTRY) {
                     $free_shipping_value_over = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
                 } else {
                     $free_shipping_value_over = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER_INTERNATIONAL;
                 }
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $xtPrice->xtcRemoveCurr($order->info['total'] - $order->info['shipping_cost']) >= $free_shipping_value_over) {
             $order->info['shipping_method'] = $this->title;
             $order->info['total'] -= $order->info['shipping_cost'];
             $order->info['shipping_cost'] = 0;
             $free_shipping = true;
         }
     }
     if (!isset($_SESSION['shipping'])) {
         return;
     }
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     if (xtc_not_null($order->info['shipping_method']) && isset($GLOBALS[$module]) && is_object($GLOBALS[$module])) {
         $tax = 0;
         $shipping_tax = 0;
         $shipping_tax_description = '';
         $shipping_tax = xtc_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $shipping_tax_description = xtc_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax = xtc_add_tax($order->info['shipping_cost'], $shipping_tax) - $order->info['shipping_cost'];
         $tax = $xtPrice->xtcFormat($tax, false, 0, true);
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             // price with tax
             $order->info['shipping_cost'] = xtc_add_tax($order->info['shipping_cost'], $shipping_tax);
             $order->info['tax'] += $tax;
             $order->info['tax_groups'][TAX_ADD_TAX . "{$shipping_tax_description}"] += $tax;
             $order->info['total'] += $tax;
         } else {
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $order->info['tax'] = $order->info['tax'] += $tax;
                 $order->info['tax_groups'][TAX_NO_TAX . "{$shipping_tax_description}"] = $order->info['tax_groups'][TAX_NO_TAX . "{$shipping_tax_description}"] += $tax;
             }
         }
         $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $xtPrice->xtcFormat($order->info['shipping_cost'], true, 0, true), 'value' => $xtPrice->xtcFormat($order->info['shipping_cost'], false, 0, true));
     }
 }
 protected function getOrderTotalTax($type)
 {
     $type = explode('_', $type, 2);
     require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
     if (defined(strtoupper('MODULE_ORDER_TOTAL_' . $type[1] . '_TAX_CLASS'))) {
         return xtc_get_tax_rate(constant(strtoupper('MODULE_ORDER_TOTAL_' . $type[1] . '_TAX_CLASS')), $this->customer['country_id'], $this->customer['zone_id']);
     } else {
         return '0';
     }
 }
/**
 * xtc_draw_products_pull_down()
 *
 * @param mixed $name
 * @param string $parameters
 * @param string $exclude
 * @return
 */
function xtc_draw_products_pull_down($name, $parameters = '', $exclude = '')
{
    global $currencies;
    if (empty($exclude)) {
        $exclude = array();
    }
    $select_string = '<select name="' . $name . '"';
    if ($parameters) {
        $select_string .= ' ' . $parameters;
    }
    $select_string .= '>';
    $products_query = xtc_db_query("select p.products_id, pd.products_name,p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' order by products_name");
    while ($products = xtc_db_fetch_array($products_query)) {
        if (!in_array($products['products_id'], $exclude)) {
            //brutto admin:
            if (PRICE_IS_BRUTTO == 'true') {
                $products['products_price'] = xtc_round($products['products_price'] * ((100 + xtc_get_tax_rate($products['products_tax_class_id'])) / 100), PRICE_PRECISION);
            }
            $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . xtc_round($products['products_price'], PRICE_PRECISION) . ')</option>';
        }
    }
    $select_string .= '</select>';
    return $select_string;
}
Beispiel #21
0
 function cart()
 {
     global $currencies, $xtPrice;
     $this->content_type = $_SESSION['cart']->get_content_type();
     $customer_address_query = xtc_db_query("select c.payment_unallowed,c.shipping_unallowed,c.customers_firstname,c.customers_cid, c.customers_gender,c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . $_SESSION['customer_id'] . "' and ab.customers_id = '" . $_SESSION['customer_id'] . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = xtc_db_fetch_array($customer_address_query);
     $shipping_address_query = xtc_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . $_SESSION['customer_id'] . "' and ab.address_book_id = '" . $_SESSION['sendto'] . "'");
     $shipping_address = xtc_db_fetch_array($shipping_address_query);
     $billing_address_query = xtc_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . $_SESSION['customer_id'] . "' and ab.address_book_id = '" . $_SESSION['billto'] . "'");
     $billing_address = xtc_db_fetch_array($billing_address_query);
     $tax_address_query = xtc_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . $_SESSION['customer_id'] . "' and ab.address_book_id = '" . ($this->content_type == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'");
     $tax_address = xtc_db_fetch_array($tax_address_query);
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $_SESSION['currency'], 'currency_value' => $xtPrice->currencies[$_SESSION['currency']]['value'], 'payment_method' => $_SESSION['payment'], 'cc_type' => isset($_SESSION['payment']) == 'cc' && isset($_SESSION['ccard']['cc_type']) ? $_SESSION['ccard']['cc_type'] : '', 'cc_owner' => isset($_SESSION['payment']) == 'cc' && isset($_SESSION['ccard']['cc_owner']) ? $_SESSION['ccard']['cc_owner'] : '', 'cc_number' => isset($_SESSION['payment']) == 'cc' && isset($_SESSION['ccard']['cc_number']) ? $_SESSION['ccard']['cc_number'] : '', 'cc_expires' => isset($_SESSION['payment']) == 'cc' && isset($_SESSION['ccard']['cc_expires']) ? $_SESSION['ccard']['cc_expires'] : '', 'cc_start' => isset($_SESSION['payment']) == 'cc' && isset($_SESSION['ccard']['cc_start']) ? $_SESSION['ccard']['cc_start'] : '', 'cc_issue' => isset($_SESSION['payment']) == 'cc' && isset($_SESSION['ccard']['cc_issue']) ? $_SESSION['ccard']['cc_issue'] : '', 'cc_cvv' => isset($_SESSION['payment']) == 'cc' && isset($_SESSION['ccard']['cc_cvv']) ? $_SESSION['ccard']['cc_cvv'] : '', 'shipping_method' => $_SESSION['shipping']['title'], 'shipping_cost' => $_SESSION['shipping']['cost'], 'comments' => $_SESSION['comments'], 'shipping_class' => $_SESSION['shipping']['id'], 'payment_class' => $_SESSION['payment']);
     if (isset($_SESSION['payment']) && is_object($_SESSION['payment'])) {
         $this->info['payment_method'] = $_SESSION['payment']->title;
         $this->info['payment_class'] = $_SESSION['payment']->title;
         if (isset($_SESSION['payment']->order_status) && is_numeric($_SESSION['payment']->order_status) && $_SESSION['payment']->order_status > 0) {
             $this->info['order_status'] = $_SESSION['payment']->order_status;
         }
     }
     $this->customer = array('firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'csID' => $customer_address['customers_cid'], 'gender' => $customer_address['customers_gender'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => xtc_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'payment_unallowed' => $customer_address['payment_unallowed'], 'shipping_unallowed' => $customer_address['shipping_unallowed'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => xtc_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => xtc_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $_SESSION['cart']->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $products_price = $xtPrice->xtcGetPrice($products[$i]['id'], $format = false, $products[$i]['quantity'], $products[$i]['tax_class_id'], '') + $xtPrice->xtcFormat($_SESSION['cart']->attributes_price($products[$i]['id']), false);
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'tax_class_id' => $products[$i]['tax_class_id'], 'tax' => xtc_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => xtc_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products_price, 'final_price' => $products_price * $products[$i]['quantity'], 'shipping_time' => $products[$i]['shipping_time'], 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             reset($products[$i]['attributes']);
             while (list($option, $value) = each($products[$i]['attributes'])) {
                 $attributes_query = xtc_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
                 $attributes = xtc_db_fetch_array($attributes_query);
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $shown_price = $this->products[$index]['final_price'];
         $this->info['subtotal'] += $shown_price;
         if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == 1) {
             $shown_price_tax = $shown_price - $shown_price / 100 * $_SESSION['customers_status']['customers_status_ot_discount'];
         }
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '1') {
             if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == 1) {
                 $this->info['tax'] += $shown_price_tax - $shown_price_tax / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                 $this->info['tax_groups'][TAX_ADD_TAX . "{$products_tax_description}"] += $shown_price_tax / (100 + $products_tax) * $products_tax;
             } else {
                 $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                 $this->info['tax_groups'][TAX_ADD_TAX . "{$products_tax_description}"] += $shown_price / (100 + $products_tax) * $products_tax;
             }
         } else {
             if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == 1) {
                 $this->info['tax'] += $shown_price_tax / 100 * $products_tax;
                 $this->info['tax_groups'][TAX_NO_TAX . "{$products_tax_description}"] += $shown_price_tax / 100 * $products_tax;
             } else {
                 $this->info['tax'] += $shown_price / 100 * $products_tax;
                 $this->info['tax_groups'][TAX_NO_TAX . "{$products_tax_description}"] += $shown_price / 100 * $products_tax;
             }
         }
         $index++;
     }
     //$this->info['shipping_cost']=0;
     if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
         $this->info['total'] = $this->info['subtotal'] + $xtPrice->xtcFormat($this->info['shipping_cost'], false, 0, true);
         if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1') {
             $this->info['total'] -= $this->info['subtotal'] / 100 * $_SESSION['customers_status']['customers_status_ot_discount'];
         }
     } else {
         $this->info['total'] = $this->info['subtotal'] + $xtPrice->xtcFormat($this->info['shipping_cost'], false, 0, true);
         if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1') {
             $this->info['total'] -= $this->info['subtotal'] / 100 * $_SESSION['customers_status']['customers_status_ot_discount'];
         }
     }
 }
 /**
  * Retrive the coupon tax rate 
  * 
  * @return float  
  */
 function getCouponTaxRate()
 {
     if ($this->piCouponIncTax == 'true') {
         $const = 'MODULE_ORDER_TOTAL_COUPON_TAX_CLASS';
         if (defined($const)) {
             $couponTaxClass = xtc_get_tax_rate(constant($const));
         } else {
             $couponTaxClass = 0;
         }
     } else {
         $couponTaxClass = 0;
     }
     return $couponTaxClass;
 }
Beispiel #23
0
 /**
  * class methods
  */
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;
     for ($j = 1; $j <= $this->num_dhl; $j++) {
         $countries_table = constant('MODULE_SHIPPING_DHL_COUNTRIES_' . $j);
         $country_zones = explode(",", $countries_table);
         // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
         if (in_array($dest_country, $country_zones)) {
             $dest_zone = $j;
             break;
         }
     }
     if ($dest_zone == 0) {
         $error = true;
     } else {
         $shipping = -1;
         $dhl_cost_ecx = @constant('MODULE_SHIPPING_DHL_COST_ECX_' . $j);
         $dhl_cost_dox = @constant('MODULE_SHIPPING_DHL_COST_DOX_' . $j);
         $dhl_cost_wpx = @constant('MODULE_SHIPPING_DHL_COST_WPX_' . $j);
         $dhl_cost_mdx = @constant('MODULE_SHIPPING_DHL_COST_MDX_' . $j);
         $dhl_cost_sdx = @constant('MODULE_SHIPPING_DHL_COST_SDX_' . $j);
         $methods = array();
         $n == 0;
         if ($dhl_cost_ecx != '') {
             $dhl_table_ecx = preg_split("/[:,]/", $dhl_cost_ecx);
             // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
             if ($shipping_weight > 10 and $shipping_weight <= 20) {
                 $shipping_ecx = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_ECX_20_' . $j) + $dhl_table_ecx[count($dhl_table_ecx) - 1];
             } elseif ($shipping_weight > 20 and $shipping_weight <= 30) {
                 $shipping_ecx = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_ECX_30_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_ECX_20_' . $j) + $dhl_table_ecx[count($dhl_table_ecx) - 1];
             } elseif ($shipping_weight > 30 and $shipping_weight <= 50) {
                 $shipping_ecx = number_format(($shipping_weight - 30) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_ECX_50_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_ECX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_ECX_30_' . $j) + $dhl_table_ecx[count($dhl_table_ecx) - 1];
             } elseif ($shipping_weight > 50) {
                 $shipping_ecx = number_format(($shipping_weight - 50) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_ECX_51_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_ECX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_ECX_30_' . $j) + 40 * constant('MODULE_SHIPPING_DHL_STEP_ECX_50_' . $j) + $dhl_table_ecx[count($dhl_table_ecx) - 1];
             } else {
                 for ($i = 0; $i < sizeof($dhl_table_ecx); $i += 2) {
                     if ($shipping_weight <= $dhl_table_ecx[$i]) {
                         $shipping_ecx = $dhl_table_ecx[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_ecx == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_DHL_UNDEFINED_RATE;
             } else {
                 $shipping_cost_1 = $shipping_ecx + MODULE_SHIPPING_DHL_HANDLING;
             }
             $methods[] = array('id' => 'ECX', 'title' => 'EU Express Service', 'cost' => (MODULE_SHIPPING_DHL_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
             $n++;
         }
         if ($dhl_cost_dox != '') {
             $dhl_table_dox = preg_split("/[:,]/", $dhl_cost_dox);
             // Hetfield - 2009-11-19 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
             if ($shipping_weight > 10 and $shipping_weight <= 20) {
                 $shipping_dox = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_DOX_20_' . $j) + $dhl_table_dox[count($dhl_table_dox) - 1];
             } elseif ($shipping_weight > 20 and $shipping_weight <= 30) {
                 $shipping_dox = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_DOX_30_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_DOX_20_' . $j) + $dhl_table_dox[count($dhl_table_dox) - 1];
             } elseif ($shipping_weight > 30 and $shipping_weight <= 50) {
                 $shipping_dox = number_format(($shipping_weight - 30) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_DOX_50_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_DOX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_DOX_30_' . $j) + $dhl_table_dox[count($dhl_table_dox) - 1];
             } elseif ($shipping_weight > 50) {
                 $shipping_dox = number_format(($shipping_weight - 50) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_DOX_51_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_DOX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_DOX_30_' . $j) + 40 * constant('MODULE_SHIPPING_DHL_STEP_DOX_50_' . $j) + $dhl_table_dox[count($dhl_table_dox) - 1];
             } else {
                 for ($i = 0; $i < sizeof($dhl_table_dox); $i += 2) {
                     if ($shipping_weight <= $dhl_table_dox[$i]) {
                         $shipping_dox = $dhl_table_dox[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_dox == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_DHL_UNDEFINED_RATE;
             } else {
                 $shipping_cost_2 = $shipping_dox + MODULE_SHIPPING_DHL_HANDLING;
             }
             $methods[] = array('id' => 'DOX', 'title' => 'Document Express Service', 'cost' => (MODULE_SHIPPING_DHL_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
             $n++;
         }
         if ($dhl_cost_wpx != '') {
             $dhl_table_wpx = preg_split("/[:,]/", $dhl_cost_wpx);
             // Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
             if ($shipping_weight > 10 and $shipping_weight <= 20) {
                 $shipping_wpx = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_WPX_20_' . $j) + $dhl_table_wpx[count($dhl_table_wpx) - 1];
             } elseif ($shipping_weight > 20 and $shipping_weight <= 30) {
                 $shipping_wpx = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_WPX_30_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_20_' . $j) + $dhl_table_wpx[count($dhl_table_wpx) - 1];
             } elseif ($shipping_weight > 30 and $shipping_weight <= 50) {
                 $shipping_wpx = number_format(($shipping_weight - 30) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_WPX_50_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_30_' . $j) + $dhl_table_wpx[count($dhl_table_wpx) - 1];
             } elseif ($shipping_weight > 50) {
                 $shipping_wpx = number_format(($shipping_weight - 50) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_WPX_51_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_30_' . $j) + 40 * constant('MODULE_SHIPPING_DHL_STEP_WPX_50_' . $j) + $dhl_table_wpx[count($dhl_table_wpx) - 1];
             } else {
                 for ($i = 0; $i < sizeof($dhl_table_wpx); $i += 2) {
                     if ($shipping_weight <= $dhl_table_wpx[$i]) {
                         $shipping_wpx = $dhl_table_wpx[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_wpx == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_DHL_UNDEFINED_RATE;
             } else {
                 $shipping_cost_3 = $shipping_wpx + MODULE_SHIPPING_DHL_HANDLING;
             }
             $methods[] = array('id' => 'WPX', 'title' => 'Waren Express Service', 'cost' => (MODULE_SHIPPING_DHL_HANDLING + $shipping_cost_3) * $shipping_num_boxes);
             $n++;
         }
         if ($dhl_cost_mdx != '') {
             $dhl_table_mdx = preg_split("/[:,]/", $dhl_cost_mdx);
             // Hetfield - 2009-11-19 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
             if ($shipping_weight > 10 and $shipping_weight <= 20) {
                 $shipping_mdx = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_MDX_20_' . $j) + $dhl_table_mdx[count($dhl_table_mdx) - 1];
             } elseif ($shipping_weight > 20 and $shipping_weight <= 30) {
                 $shipping_mdx = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_MDX_30_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_20_' . $j) + $dhl_table_mdx[count($dhl_table_mdx) - 1];
             } elseif ($shipping_weight > 30 and $shipping_weight <= 50) {
                 $shipping_mdx = number_format(($shipping_weight - 30) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_MDX_50_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_30_' . $j) + $dhl_table_mdx[count($dhl_table_mdx) - 1];
             } elseif ($shipping_weight > 50) {
                 $shipping_mdx = number_format(($shipping_weight - 50) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_MDX_51_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_30_' . $j) + 40 * constant('MODULE_SHIPPING_DHL_STEP_MDX_50_' . $j) + $dhl_table_mdx[count($dhl_table_mdx) - 1];
             } else {
                 for ($i = 0; $i < sizeof($dhl_table_mdx); $i += 2) {
                     if ($shipping_weight <= $dhl_table_mdx[$i]) {
                         $shipping_mdx = $dhl_table_mdx[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_mdx == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_DHL_UNDEFINED_RATE;
             } else {
                 $shipping_cost_4 = $shipping_mdx + MODULE_SHIPPING_DHL_HANDLING;
             }
             $methods[] = array('id' => 'MDX', 'title' => 'Mid Day Express Service', 'cost' => (MODULE_SHIPPING_DHL_HANDLING + $shipping_cost_4) * $shipping_num_boxes);
             $n++;
         }
         if ($dhl_cost_sdx != '') {
             $dhl_table_sdx = preg_split("/[:,]/", $dhl_cost_sdx);
             // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
             if ($shipping_weight > 10 and $shipping_weight <= 20) {
                 $shipping_sdx = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_SDX_20_' . $j) + $dhl_table_sdx[count($dhl_table_sdx) - 1];
             } elseif ($shipping_weight > 20 and $shipping_weight <= 30) {
                 $shipping_sdx = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_SDX_30_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_20_' . $j) + $dhl_table_sdx[count($dhl_table_sdx) - 1];
             } elseif ($shipping_weight > 30 and $shipping_weight <= 50) {
                 $shipping_sdx = number_format(($shipping_weight - 30) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_SDX_50_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_30_' . $j) + $dhl_table_sdx[count($dhl_table_sdx) - 1];
             } elseif ($shipping_weight > 50) {
                 $shipping_sdx = number_format(($shipping_weight - 50) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_SDX_51_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_30_' . $j) + 40 * constant('MODULE_SHIPPING_DHL_STEP_SDX_50_' . $j) + $dhl_table_sdx[count($dhl_table_sdx) - 1];
             } else {
                 for ($i = 0; $i < sizeof($dhl_table_sdx); $i += 2) {
                     if ($shipping_weight <= $dhl_table_sdx[$i]) {
                         $shipping_sdx = $dhl_table_sdx[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_sdx == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_DHL_UNDEFINED_RATE;
             } else {
                 $shipping_cost_5 = $shipping_sdx + MODULE_SHIPPING_DHL_HANDLING;
             }
             $methods[] = array('id' => 'SDX', 'title' => 'Start Day Express Service', 'cost' => (MODULE_SHIPPING_DHL_HANDLING + $shipping_cost_5) * $shipping_num_boxes);
             $n++;
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => $this->title . ' ' . $dest_country . ' : ' . $shipping_num_boxes * $shipping_weight . ' ' . MODULE_SHIPPING_DHL_TEXT_UNITS . ')');
     $this->quotes['methods'] = $methods;
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     if ($error == true) {
         $this->quotes['error'] = MODULE_SHIPPING_DHL_INVALID_ZONE;
     }
     if (xtc_not_null($method) && isset($this->types[$method])) {
         for ($i = 0; $i < sizeof($methods); $i++) {
             if ($method == $methods[$i]['id']) {
                 $methodsc = array();
                 $methodsc[] = array('id' => $methods[$i]['id'], 'title' => $methods[$i]['title'], 'cost' => $methods[$i]['cost']);
                 break;
             }
         }
         $this->quotes['methods'] = $methodsc;
     }
     return $this->quotes;
 }
 /**
  * add discounts or agio (e.g. ot_sofort, loworderfee, discount...) to $this->invoice
  */
 function _addPriceModificatorsToInvoice($customer_id, $orderTotals)
 {
     //check optional price-modificators
     if (is_array($orderTotals)) {
         foreach ($orderTotals as $totalModule) {
             $itemId = 'discount|' . substr($totalModule['code'], 0, 22);
             if ($totalModule['code'] == 'ot_sofort') {
                 $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_SOFORT_TAX_CLASS);
                 $amountValue = $totalModule['value'];
                 $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax);
                 continue;
             }
             if ($totalModule['code'] == 'ot_discount') {
                 $tax = 19;
                 $amountValue = $totalModule['value'] > 0 ? $totalModule['value'] * -1 : $totalModule['value'];
                 $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax);
                 continue;
             }
             if ($totalModule['code'] == 'ot_gv') {
                 $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_GV_TAX_CLASS);
                 $amountValue = $totalModule['value'] > 0 ? $totalModule['value'] * -1 : $totalModule['value'];
                 $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax);
                 continue;
             }
             if ($totalModule['code'] == 'ot_coupon') {
                 $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_COUPON_TAX_CLASS);
                 $amountValue = $totalModule['value'] > 0 ? $totalModule['value'] * -1 : $totalModule['value'];
                 $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax);
                 continue;
             }
             $itemId = 'agio|' . substr($totalModule['code'], 0, 26);
             if ($totalModule['code'] == 'ot_loworderfee') {
                 $tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS);
                 $amountValue = $totalModule['value'];
                 $this->invoice->addItemToInvoice($itemId, '', HelperFunctions::convertEncoding(html_entity_decode($totalModule['title'], ENT_QUOTES, HelperFunctions::getIniValue('shopEncoding')), 3), $amountValue, 2, '', 1, $tax);
                 continue;
             }
         }
     }
 }
     } 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
 } else {
     $module_n_price = $module_value['value'];
 function get_shipping_cost()
 {
     global $order, $xtPrice;
     $shipping_module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     $shipping_cost = $order->info['shipping_cost'];
     //BRUTTO PREISE - Steuer bei Versandkosten hinzuf�gen
     if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '1') {
         $shipping_tax_rate = xtc_get_tax_rate($GLOBALS[$shipping_module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $shipping_tax = $order->info['shipping_cost'] * ($shipping_tax_rate / 100 + 1) - $order->info['shipping_cost'];
         $shipping_cost = $order->info['shipping_cost'] + $shipping_tax;
         $shipping_cost = $xtPrice->xtcFormat($shipping_cost, false);
         //RUNDEN
     }
     return $shipping_cost;
 }
Beispiel #27
0
 /**
  * class methods
  */
 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;
     for ($i = 1; $i <= $this->num_ap; $i++) {
         $countries_table = constant('MODULE_SHIPPING_AP_COUNTRIES_' . $i);
         $country_zones = explode(",", $countries_table);
         // Hetfield - 2009-08-18 - replaced deprecated function split with explode to be ready for PHP >= 5.3
         if (in_array($dest_country, $country_zones)) {
             $dest_zone = $i;
             break;
         }
     }
     if ($dest_zone == 0) {
         $error = true;
     } else {
         $shipping = -1;
         $ap_cost = constant('MODULE_SHIPPING_AP_COST_' . $i);
         $ap_table = preg_split("/[:,]/", $ap_cost);
         // Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
         for ($i = 0; $i < sizeof($ap_table); $i += 2) {
             if ($shipping_weight <= $ap_table[$i]) {
                 $shipping = $ap_table[$i + 1];
                 $shipping_method = MODULE_SHIPPING_AP_TEXT_WAY . ' ' . $dest_country . ' : ' . $shipping_num_boxes * $shipping_weight . ' ' . MODULE_SHIPPING_AP_TEXT_UNITS;
                 break;
             }
         }
         if ($shipping == -1) {
             $shipping_cost = 0;
             $shipping_method = MODULE_SHIPPING_AP_UNDEFINED_RATE;
         } else {
             $shipping_cost = $shipping + MODULE_SHIPPING_AP_HANDLING;
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_AP_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost * $shipping_num_boxes)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (xtc_not_null($this->icon)) {
         $this->quotes['icon'] = xtc_image($this->icon, $this->title);
     }
     if ($error == true) {
         $this->quotes['error'] = MODULE_SHIPPING_AP_INVALID_ZONE;
     }
     return $this->quotes;
 }
 function get_rakuten_tax_class($gambio_tax_class)
 {
     $tax_class_map = array('1' => 0, '2' => 7, '3' => 10.7, '4' => 19, '6' => 10, '7' => 12, '8' => 20);
     $tax_class_default = '4';
     $percent = xtc_get_tax_rate($gambio_tax_class);
     $percent = round($percent, 2);
     if ($tax_class = array_search($percent, $tax_class_map)) {
         return (string) $tax_class;
     } else {
         return $tax_class_default;
     }
 }
Beispiel #29
0
 function selection()
 {
     global $xtPrice, $order;
     if (MODULE_ORDER_TOTAL_COD_FEE_STATUS == 'true') {
         $cod_country = false;
         //process installed shipping modules
         // BOF - Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
         if ($_SESSION['shipping']['id'] == 'flat_flat') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
         }
         if ($_SESSION['shipping']['id'] == 'item_item') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
         }
         if ($_SESSION['shipping']['id'] == 'table_table') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
         }
         if ($_SESSION['shipping']['id'] == 'zones_zones') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
         }
         if ($_SESSION['shipping']['id'] == 'ap_ap') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_AP);
         }
         if ($_SESSION['shipping']['id'] == 'dp_dp') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DP);
         }
         if ($_SESSION['shipping']['id'] == 'chp_ECO') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
         }
         if ($_SESSION['shipping']['id'] == 'chp_PRI') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
         }
         if ($_SESSION['shipping']['id'] == 'chp_URG') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
         }
         if ($_SESSION['shipping']['id'] == 'chronopost_chronopost') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHRONOPOST);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_ECX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_DOX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_SDX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_MDX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_WPX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'ups_ups') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_UPS);
         }
         if ($_SESSION['shipping']['id'] == 'upse_upse') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_UPSE);
         }
         if ($_SESSION['shipping']['id'] == 'free_free') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FREE);
         }
         if ($_SESSION['shipping']['id'] == 'freeamount_freeamount') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_FREEAMOUNT_FREE);
         }
         // EOF - Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
         for ($i = 0; $i < count($cod_zones); $i++) {
             if ($cod_zones[$i] == $order->delivery['country']['iso_code_2']) {
                 $cod_cost = $cod_zones[$i + 1];
                 $cod_country = true;
                 break;
             } elseif ($cod_zones[$i] == '00') {
                 $cod_cost = $cod_zones[$i + 1];
                 $cod_country = true;
                 break;
             } else {
             }
             $i++;
         }
     } else {
         //COD selected, but no shipping module which offers COD
     }
     if ($cod_country) {
         $cod_tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $cod_tax_description = xtc_get_tax_description(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             $cod_cost_value = xtc_add_tax($cod_cost, $cod_tax);
             $cod_cost = $xtPrice->xtcFormat($cod_cost_value, true);
         }
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
             $cod_cost_value = $cod_cost;
             $cod_cost = $xtPrice->xtcFormat($cod_cost, true);
         }
         if (!$cod_cost_value) {
             $cod_cost_value = $cod_cost;
             $cod_cost = $xtPrice->xtcFormat($cod_cost, true);
         }
         $this->cost = '+ ' . $cod_cost;
     }
     return array('id' => $this->code, 'module' => $this->title, 'description' => $this->info, 'module_cost' => $this->cost);
 }
 function calculate_tax_deduction($amount, $od_amount, $method)
 {
     global $order;
     switch ($method) {
         case 'Standard':
             $ratio1 = number_format($od_amount / $amount, 2);
             $tod_amount = 0;
             reset($order->info['tax_groups']);
             while (list($key, $value) = each($order->info['tax_groups'])) {
                 $tax_rate = xtc_get_tax_rate_from_desc($key);
                 $total_net += $tax_rate * $order->info['tax_groups'][$key];
             }
             if ($od_amount > $total_net) {
                 $od_amount = $total_net;
             }
             reset($order->info['tax_groups']);
             while (list($key, $value) = each($order->info['tax_groups'])) {
                 $tax_rate = xtc_get_tax_rate_from_desc($key);
                 $net = $tax_rate * $order->info['tax_groups'][$key];
                 if ($net > 0) {
                     $god_amount = $order->info['tax_groups'][$key] * $ratio1;
                     $tod_amount += $god_amount;
                     $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;
                 }
             }
             $order->info['tax'] -= $tod_amount;
             $order->info['total'] -= $tod_amount;
             break;
         case 'Credit Note':
             $tax_rate = xtc_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax_desc = xtc_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tod_amount = $this->deduction / (100 + $tax_rate) * $tax_rate;
             $order->info['tax_groups'][$tax_desc] -= $tod_amount;
             //          $order->info['total'] -= $tod_amount;   //// ????? Strider
             break;
         default:
     }
     return $tod_amount;
 }