本文整理汇总了PHP中xtc_get_tax_rate函数的典型用法代码示例。如果您正苦于以下问题:PHP xtc_get_tax_rate函数的具体用法?PHP xtc_get_tax_rate怎么用?PHP xtc_get_tax_rate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xtc_get_tax_rate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quote
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;
}
示例2: quote
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;
}
示例3: process
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);
}
}
}
示例4: getShippingTaxRate
/**
* 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;
}
示例5: product_to_EMOSItem
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;
}
示例6: quote
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;
}
示例7: quote
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;
}
示例8: xtcGetPrice
/**
* 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);
}
示例9: showSpecialsBox
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">« Sonderangebot</a>';
} else {
document.getElementById("special").style.display="none";
document.getElementById('butSpecial').innerHTML= '<a href="JavaScript:showSpecial()" class="btn btn-default">Sonderangebot »</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">
//.........这里部分代码省略.........
示例10: splitPageResults
echo TABLE_HEADING_ACTION;
?>
</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";
示例11: getTotalsOrderProducts
$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);
示例12: getOrderTotal
/**
* 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;
}
示例13: process
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("",", " \"", $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;
}
}
示例14: quote
/**
* 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']);
//.........这里部分代码省略.........
示例15: shopGetTaxRate
function shopGetTaxRate($class_id)
{
return xtc_get_tax_rate($class_id);
}