本文整理汇总了PHP中olc_get_tax_rate函数的典型用法代码示例。如果您正苦于以下问题:PHP olc_get_tax_rate函数的具体用法?PHP olc_get_tax_rate怎么用?PHP olc_get_tax_rate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了olc_get_tax_rate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quote
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes;
if (!$order) {
$order = new order();
$shipping_weight = $_SESSION['cart']->show_weight();
}
$order_delivery_country = $order->delivery['country'];
if (MODULE_SHIPPING_TABLE_MODE == 'price') {
$order_total = $_SESSION['cart']->show_total();
} else {
$order_total = $shipping_weight;
}
$table_cost = split("[:,]", MODULE_SHIPPING_TABLE_COST);
$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'] = olc_get_tax_rate($this->tax_class, $order_delivery_country['id'], $order->delivery['zone_id']);
}
if (olc_not_null($this->icon)) {
$this->quotes['icon'] = olc_image($this->icon, $this->title);
}
return $this->quotes;
}
示例2: olc_format_price_graduated
function olc_format_price_graduated($price_string, $price_special, $calculate_currencies, $products_tax_class)
{
if ((int) $price_string == 0) {
$price_string = EMPTY_STRING;
} else {
include DIR_FS_INC . 'olc_get_currency_parameters.inc.php';
if ($calculate_currencies == TRUE_STRING_S) {
$price_string = $price_string * CURRENCY_VALUE;
}
// add tax
if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') {
$products_tax = olc_get_tax_rate($products_tax_class);
$price_string = olc_add_tax($price_string, $products_tax);
}
// round price
$price_string = olc_precision($price_string, CURRENCY_DECIMAL_PLACES);
if ($price_special == '1') {
$price_string = number_format($price_string, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT);
$price_string = CURRENCY_SYMBOL_LEFT . $price_string . CURRENCY_SYMBOL_RIGHT;
}
//1,00 -> 1,--
global $is_print_version, $is_pdf;
if ($is_print_version) {
if ($is_pdf) {
$s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT_PDF;
} else {
$s = CURRENCY_DECIMAL_ZEROES_DASHES_PRINT;
}
} else {
$s = CURRENCY_DECIMAL_ZEROES_DASHES;
}
$price_string = str_replace(CURRENCY_DECIMAL_ZEROES, $s, $price_string);
}
return $price_string;
}
示例3: olc_get_products_attribute_price
function olc_get_products_attribute_price($attribute_price, $tax_class, $price_special, $quantity, $prefix, $calculate_currencies = TRUE_STRING_S)
{
if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
$attribute_tax = olc_get_tax_rate($tax_class);
// check if user is allowed to see tax rates
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
$attribute_tax = '';
}
// add tax
$price_string = olc_add_tax($attribute_price, $attribute_tax) * $quantity;
if ($_SESSION['customers_status']['customers_status_discount_attributes'] == '0') {
// format price & calculate currency
$price_string = olc_format_price($price_string, $price_special, $calculate_currencies);
if ($price_special == '1') {
$price_string = BLANK . $prefix . BLANK . $price_string . BLANK;
}
} else {
$discount = $_SESSION['customers_status']['customers_status_discount'];
$rabatt_string = $price_string - $price_string / 100 * $discount;
$price_string = olc_format_price($price_string, $price_special, $calculate_currencies);
$rabatt_string = olc_format_price($rabatt_string, $price_special, $calculate_currencies);
if ($price_special == '1' && $price_string != $rabatt_string) {
$price_string = BLANK . $prefix . '<font color="ff0000"><s>' . $price_string . '</s></font> ' . $rabatt_string . BLANK;
} else {
$price_string = $rabatt_string;
if ($price_special == '1') {
$price_string = BLANK . $prefix . BLANK . $price_string;
}
}
}
} else {
$price_string = ' ' . NOT_ALLOWED_TO_SEE_PRICES;
}
return $price_string;
}
示例4: process
function process()
{
global $order, $currencies;
if (MODULE_ORDER_TOTAL_VERPACKUNG_LOW_ORDER_FEE == TRUE_STRING_S) {
switch (MODULE_ORDER_TOTAL_VERPACKUNG_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['verpackung_cost'] < MODULE_ORDER_TOTAL_VERPACKUNG_ORDER_UNDER) {
$tax = olc_get_tax_rate(MODULE_ORDER_TOTAL_VERPACKUNG_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$tax_description = olc_get_tax_description(MODULE_ORDER_TOTAL_VERPACKUNG_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['tax'] += olc_calculate_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax);
$order->info['tax_groups']["{$tax_description}"] += olc_calculate_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax);
$order->info['total'] += MODULE_ORDER_TOTAL_VERPACKUNG_FEE + olc_calculate_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax);
$this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(olc_add_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => olc_add_tax(MODULE_ORDER_TOTAL_VERPACKUNG_FEE, $tax));
}
}
}
示例5: get_order_total
function get_order_total()
{
global $order, $cart;
$order_total = $order->info['total'];
// Check if gift voucher is in cart and adjust total
$products = $cart->get_products();
for ($i = 0; $i < sizeof($products); $i++) {
$t_prid = olc_get_prid($products[$i]['id']);
$gv_query = olc_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . APOS);
$gv_result = olc_db_fetch_array($gv_query);
if (ereg('^GIFT', addslashes($gv_result['products_model']))) {
$qty = $cart->get_quantity($t_prid);
$products_tax = olc_get_tax_rate($gv_result['products_tax_class_id']);
if ($this->include_tax == FALSE_STRING_S) {
$gv_amount = $gv_result['products_price'] * $qty;
} else {
$gv_amount = ($gv_result['products_price'] + olc_calculate_tax($gv_result['products_price'], $products_tax)) * $qty;
}
$order_total = $order_total - $gv_amount;
}
}
if ($this->include_tax == FALSE_STRING_S) {
$order_total = $order_total - $order->info['tax'];
}
if ($this->include_shipping == FALSE_STRING_S) {
$order_total = $order_total - $order->info['shipping_cost'];
}
return $order_total;
}
示例6: process
function process()
{
global $order, $currencies;
if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == TRUE_STRING_S) {
$pass = false;
if ($_SESSION['shipping']['id'] != 'selfpickup_selfpickup') {
$country = $order->delivery['country_id'];
switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
case 'national':
if ($country == STORE_COUNTRY) {
$pass = true;
}
break;
case 'international':
if ($country != STORE_COUNTRY) {
$pass = true;
}
break;
case 'both':
$pass = true;
break;
}
}
if ($pass) {
if ($order->info['total'] - $order->info['shipping_cost'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
$delivery_country = $order->delivery['country']['id'];
$delivery_zone_id = $order->delivery['zone_id'];
$tax = olc_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $delivery_country, $delivery_zone_id);
$tax_description = olc_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $delivery_country, $delivery_zone_id);
$low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
$low_order_fee_tax = olc_calculate_tax($low_order_fee, $tax);
$low_order_fee = olc_add_tax($low_order_fee, $tax);
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
$order->info['tax'] += $low_order_fee_tax;
$order->info['tax_groups'][TAX_ADD_TAX . "{$tax_description}"] += $low_order_fee_tax;
$order->info['total'] += $low_order_fee;
} else {
if ($_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
$order->info['tax'] += $low_order_fee_tax;
$order->info['tax_groups'][TAX_NO_TAX . "{$tax_description}"] += $low_order_fee_tax;
}
$order->info['subtotal'] += $low_order_fee;
$order->info['total'] += $low_order_fee;
}
$this->output[] = array('title' => $this->title . ':', 'text' => olc_format_price($low_order_fee, 1, 1, 1), 'value' => $low_order_fee);
}
}
}
}
示例7: process
function process()
{
global $order, $currencies, $customer_id;
// if (MODULE_ORDER_TOTAL_HANDLING_HANDLING == TRUE_STRING_S) {
$freequery = olc_db_query("SELECT SUM(cb.customers_basket_quantity) AS total FROM " . TABLE_CUSTOMERS_BASKET . " cb LEFT JOIN " . TABLE_PRODUCTS . " p ON cb.products_id = p.products_id WHERE cb.customers_id = '" . $customer_id . "' AND cb.final_price < '0.01' AND p.products_price < '0.01'");
$freestuff = olc_db_fetch_array($freequery);
$freeitems = $freestuff['total'];
$handlingfree = $order->info['subtotal'] / 100 * 0.85;
$tax = olc_get_tax_rate(MODULE_ORDER_TOTAL_HANDLING_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$tax_description = olc_get_tax_description(MODULE_ORDER_TOTAL_HANDLING_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['tax'] += olc_calculate_tax($handlingfree, $tax);
$order->info['tax_groups']["{$tax_description}"] += olc_calculate_tax($handlingfree, $tax);
$order->info['total'] += $handlingfree + olc_calculate_tax($handlingfree, $tax);
$this->output[] = array('title' => $this->title . ':', 'text' => olc_format_price(olc_add_tax($handlingfree, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => olc_add_tax($handlingfree, $tax));
}
示例8: olcGetPrice
function olcGetPrice($pID, $format = true, $qty, $tax_class, $pPrice, $vpeStatus = 0, $cedit_id = 0, $show_tax = 0)
{
// check if group is allowed to see prices
if ($this->cStatus['customers_status_show_price'] == '0') {
return $this->olcShowNote($vpeStatus, $vpeStatus);
}
// get Tax rate
if ($cedit_id != 0) {
$cinfo = olc_oe_customer_infos($cedit_id);
$products_tax = olc_get_tax_rate($tax_class, $cinfo['country_id'], $cinfo['zone_id']);
} else {
$products_tax = $this->TAX[$tax_class];
}
if ($show_tax == 0) {
if ($this->cStatus['customers_status_show_price_tax'] == '0') {
$products_tax = '';
}
}
// add taxes
if ($pPrice == 0) {
$pPrice = $this->getPprice($pID);
}
$pPrice = $this->olcAddTax($pPrice, $products_tax);
// check specialprice
if ($sPrice = $this->olcCheckSpecial($pID)) {
return $this->olcFormatSpecial($pID, $this->olcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus);
}
// check graduated
if ($this->cStatus['customers_status_graduated_prices'] == '1') {
if ($sPrice = $this->olcGetGraduatedPrice($pID, $qty)) {
return $this->olcFormatSpecialGraduated($pID, $this->olcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $pID);
}
} else {
// check Group Price
if ($sPrice = $this->olcGetGroupPrice($pID, 1)) {
return $this->olcFormatSpecialGraduated($pID, $this->olcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $pID);
}
}
// check Product Discount
if ($discount = $this->olcCheckDiscount($pID)) {
return $this->olcFormatSpecialDiscount($pID, $discount, $pPrice, $format, $vpeStatus);
}
return $this->olcFormat($pPrice, $format, 0, false, $vpeStatus, $pID);
}
示例9: quote
function quote($method = '')
{
global $order, $total_count;
if (!$order) {
$order = new order();
}
if (!$shipping_weight) {
$shipping_weight = $_SESSION['cart']->show_weight();
}
$order_delivery_country = $order->delivery['country'];
$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'] = olc_get_tax_rate($this->tax_class, $order_delivery_country['id'], $order->delivery['zone_id']);
}
if (olc_not_null($this->icon)) {
$this->quotes['icon'] = olc_image($this->icon, $this->title);
}
return $this->quotes;
}
示例10: olc_oe_get_products_attribute_price
function olc_oe_get_products_attribute_price($attribute_price, $tax_class, $price_special, $quantity, $prefix, $calculate_currencies = TRUE_STRING_S, $customer_status)
{
$customers_status_query = olc_db_query("select * from " . TABLE_CUSTOMERS_STATUS . " where customers_status_id = '" . $customer_status . "' ");
$customers_status = olc_db_fetch_array($customers_status_query);
if ($customers_status['customers_status_show_price'] == '1') {
$attribute_tax = olc_get_tax_rate($tax_class);
// check if user is allowed to see tax rates
if ($customers_status['customers_status_show_price_tax'] == '0') {
$attribute_tax = '';
}
// add tax
$price_string = olc_add_tax($attribute_price, $attribute_tax) * $quantity;
if ($customers_status['customers_status_discount_attributes'] == '0') {
// format price & calculate currency
$price_string = olc_format_price($price_string, $price_special, $calculate_currencies);
if ($price_special == '1') {
$price_string = BLANK . $prefix . BLANK . $price_string . BLANK;
}
} else {
$discount = $customers_status['customers_status_discount'];
$rabatt_string = $price_string - $price_string / 100 * $discount;
$price_string = olc_format_price($price_string, $price_special, $calculate_currencies);
$rabatt_string = olc_format_price($rabatt_string, $price_special, $calculate_currencies);
if ($price_special == '1' && $price_string != $rabatt_string) {
$price_string = BLANK . $prefix . '<font color="ff0000"><s>' . $price_string . '</s></font> ' . $rabatt_string . BLANK;
} else {
$price_string = $rabatt_string;
if ($price_special == '1') {
$price_string = BLANK . $prefix . BLANK . $price_string;
}
}
}
} else {
$price_string = ' ' . NOT_ALLOWED_TO_SEE_PRICES;
}
return $price_string;
}
开发者ID:BackupTheBerlios,项目名称:ol-commerce-svn,代码行数:37,代码来源:olc_oe_get_products_attribute_price.inc.php
示例11: process
function process()
{
global $order, $currencies, $cod_cost, $cod_country, $shipping;
if (strtolower(MODULE_ORDER_TOTAL_COD_STATUS) == TRUE_STRING_S) {
//Will become true, if cod can be processed.
$cod_country = false;
//check if payment method is cod. If yes, check if cod is possible.
if ($_SESSION['payment'] == 'cod') {
//process installed shipping modules
$shipping_id = $_SESSION['shipping']['id'];
$split_text = "[:,]";
if ($shipping_id == 'flat_flat') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_FLAT);
} elseif ($shipping_id == 'item_item') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_ITEM);
} elseif ($shipping_id == 'table_table') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_TABLE);
} elseif ($shipping_id == 'zones_zones') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_ZONES);
} elseif ($shipping_id == 'ap_ap') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_AP);
} elseif ($shipping_id == 'dp_dp') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_DP);
} elseif ($shipping_id == 'dpd_dpd') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_DPD);
} elseif ($shipping_id == 'ups_ups') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_UPS);
} elseif ($shipping_id == 'upse_upse') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_UPSE);
} elseif ($shipping_id == 'freeamountausl_freeamountausl') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_FREEAMOUNTAUSL);
} elseif ($shipping_id == 'freeamount_freeamount') {
$cod_zones = split($split_text, MODULE_ORDER_TOTAL_COD_FEE_FREEAMOUNT);
}
$country_iso_code_2 = $order->billing['country']['iso_code_2'];
for ($i = 0; $i < count($cod_zones); $i++) {
if ($cod_zones[$i] == $country_iso_code_2) {
$cod_cost = $cod_zones[$i + 1];
$cod_country = true;
//print('match' . $cod_zones[$i] . ': ' . $cod_cost);
break;
} elseif ($cod_zones[$i] == '00') {
$cod_cost = $cod_zones[$i + 1];
$cod_country = true;
//print('match' . $i . ': ' . $cod_cost);
break;
} else {
//print('no match');
}
$i++;
}
} else {
//COD selected, but no shipping module which offers COD
}
if ($cod_country) {
$cod_tax = olc_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$cod_tax_description = olc_get_tax_description(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
$order->info['tax'] += olc_add_tax($cod_cost, $cod_tax) - $cod_cost;
$order->info['tax_groups'][TAX_ADD_TAX . "{$cod_tax_description}"] += olc_add_tax($cod_cost, $cod_tax) - $cod_cost;
$order->info['total'] += $cod_cost + (olc_add_tax($cod_cost, $cod_tax) - $cod_cost);
$cod_cost_value = olc_add_tax($cod_cost, $cod_tax);
$cod_cost = olc_format_price($cod_cost_value, $price_special = 1, $calculate_currencies = true);
}
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
$order->info['tax'] += olc_add_tax($cod_cost, $cod_tax) - $cod_cost;
$order->info['tax_groups'][TAX_NO_TAX . "{$cod_tax_description}"] += olc_add_tax($cod_cost, $cod_tax) - $cod_cost;
$cod_cost_value = $cod_cost;
$cod_cost = olc_format_price($cod_cost, $price_special = 1, $calculate_currencies = true);
$order->info['subtotal'] += $cod_cost_value;
$order->info['total'] += $cod_cost_value;
}
if (!$cod_cost_value) {
$cod_cost_value = $cod_cost;
$cod_cost = olc_format_price($cod_cost, $price_special = 1, $calculate_currencies = true);
$order->info['total'] += $cod_cost_value;
}
$this->output[] = array('title' => $this->title . ':', 'text' => $cod_cost, 'value' => $cod_cost_value);
} else {
//Following code should be improved if we can't get the shipping modules disabled, who don't allow COD
// as well as countries who do not have cod
// $this->output[] = array('title' => $this->title . ':',
// 'text' => 'No COD for this module.',
// 'value' => '');
}
}
}
示例12: quote
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes;
if (!$order) {
$order = new order();
}
if (!$shipping_weight) {
$shipping_weight = $_SESSION['cart']->show_weight();
}
$order_delivery_country = $order->delivery['country'];
$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 = split("[,]", $countries_table);
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 = split("[:,]", $chp_cost_eco);
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 = split("[:,]", $chp_cost_pri);
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 = split("[:,]", $chp_cost_urg);
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 . LPAREN . $shipping_num_boxes . ' x ' . number_format($shipping_weight, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT) . BLANK . MODULE_SHIPPING_CHP_TEXT_UNITS . RPAREN);
$this->quotes['methods'] = $methods;
if ($this->tax_class > 0) {
$this->quotes['tax'] = olc_get_tax_rate($this->tax_class, $order_delivery_country['id'], $order->delivery['zone_id']);
}
if (olc_not_null($this->icon)) {
$this->quotes['icon'] = olc_image($this->icon, $this->title);
}
if ($error == true) {
$this->quotes['error'] = MODULE_SHIPPING_CHP_INVALID_ZONE;
}
if (olc_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']);
//.........这里部分代码省略.........
示例13: process
function process()
{
global $order, $currencies;
$shipping_cost = $order->info['shipping_cost'];
if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == TRUE_STRING_S) {
$country_id = $order->delivery['country_id'];
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
case 'national':
if ($country_id == STORE_COUNTRY) {
$pass = true;
}
break;
case 'international':
if ($country_id != STORE_COUNTRY) {
$pass = true;
}
break;
case 'both':
$pass = true;
break;
default:
$pass = false;
break;
}
if ($pass) {
$total_ex_ship = $order->info['total'] - $shipping_cost;
if ($total_ex_ship >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
$shipping_method = $this->title . LPAREN . sprintf(FREE_SHIPPING_DESCRIPTION, olc_format_price(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER, true, true, true)) . RPAREN;
$order->info['shipping_method'] = $shipping_method;
$order->info['total'] = $total_ex_ship;
$shipping_cost = 0;
}
}
}
if (true or $shipping_cost > 0) {
$module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], UNDERSCORE));
if (olc_not_null($order->info['shipping_method'])) {
$tax_class = $GLOBALS[$module]->tax_class;
$country_id = $order->delivery['country']['id'];
$zone_id = $order->delivery['zone_id'];
$shipping_tax = olc_get_tax_rate($tax_class, $country_id, $zone_id);
$shipping_tax_description = olc_get_tax_description($tax_class, $country_id, $zone_id);
$new_shipping_cost = olc_add_tax($shipping_cost, $shipping_tax);
$tax = $new_shipping_cost - $shipping_cost;
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
// price with tax
$shipping_cost = $new_shipping_cost;
$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_add_tax_ot'] == 1) {
$order->info['tax'] += $tax;
$order->info['tax_groups'][TAX_NO_TAX . "{$shipping_tax_description}"] += $tax;
}
}
if (true or $shipping_cost) {
$this->output[] = array('title' => $order->info['shipping_method'] . COLON, 'text' => olc_format_price($shipping_cost, true, true, true, true), 'value' => $shipping_cost);
}
}
}
}
示例14: quote
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes;
if (!$order) {
$order = new order();
}
if (!$shipping_weight) {
$shipping_weight = $_SESSION['cart']->show_weight();
}
$order_delivery_country = $order->delivery['country'];
$dest_country = $order_delivery_country['iso_code_2'];
$dest_zone = 0;
$error = false;
for ($i = 1; $i <= $this->num_dp; $i++) {
$countries_table = constant('MODULE_SHIPPING_DP_COUNTRIES_' . $i);
$country_zones = split("[,]", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
}
}
if ($dest_zone == 0) {
$error = true;
} else {
$shipping = -1;
$dp_cost = constant('MODULE_SHIPPING_DP_COST_' . $i);
$dp_table = split("[:,]", $dp_cost);
for ($i = 0; $i < sizeof($dp_table); $i += 2) {
if ($shipping_weight <= $dp_table[$i]) {
$shipping = $dp_table[$i + 1];
$shipping_method = MODULE_SHIPPING_DP_TEXT_WAY . BLANK . $order_delivery_country['title'] . ': ';
break;
}
}
if ($shipping == -1) {
$shipping_cost = 0;
$shipping_method = MODULE_SHIPPING_DP_UNDEFINED_RATE;
} else {
$shipping_cost = $shipping + MODULE_SHIPPING_DP_HANDLING;
}
}
$this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_DP_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method . LPAREN . $shipping_num_boxes . ' x ' . number_format($shipping_weight, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT) . BLANK . MODULE_SHIPPING_DP_TEXT_UNITS . RPAREN, 'cost' => $shipping_cost * $shipping_num_boxes)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = olc_get_tax_rate($this->tax_class, $order_delivery_country['id'], $order->delivery['zone_id']);
}
if (olc_not_null($this->icon)) {
$this->quotes['icon'] = olc_image($this->icon, $this->title);
}
if ($error == true) {
$this->quotes['error'] = MODULE_SHIPPING_DP_INVALID_ZONE;
}
return $this->quotes;
}
示例15: quote
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes;
if (!$order) {
$order = new order();
}
if (!$shipping_weight) {
$shipping_weight = $_SESSION['cart']->show_weight();
}
$order_delivery_country = $order->delivery['country'];
$dest_country = $order_delivery_country['iso_code_2'];
$dest_zone = 0;
$error = false;
for ($j = 1; $j <= $this->num_fedexeu; $j++) {
$countries_table = constant('MODULE_SHIPPING_FEDEXEU_COUNTRIES_' . $j);
$country_zones = split("[,]", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $j;
break;
}
}
if ($dest_zone == 0) {
$error = true;
} else {
$shipping = -1;
$fedexeu_cost_env = @constant('MODULE_SHIPPING_FEDEXEU_COST_ENV_' . $j);
$fedexeu_cost_pak = @constant('MODULE_SHIPPING_FEDEXEU_COST_PAK_' . $j);
$fedexeu_cost_box = @constant('MODULE_SHIPPING_FEDEXEU_COST_BOX_' . $j);
$methods = array();
if ($fedexeu_cost_pak != '') {
$fedexeu_table_pak = split("[:,]", $fedexeu_cost_pak);
for ($i = 0; $i < sizeof($fedexeu_table_pak); $i += 2) {
if ($shipping_weight <= $fedexeu_table_pak[$i]) {
$shipping_pak = $fedexeu_table_pak[$i + 1];
break;
}
}
if ($shipping_pak == -1) {
$shipping_cost = 0;
$shipping_method = MODULE_SHIPPING_FEDEXEU_UNDEFINED_RATE;
} else {
$shipping_cost_1 = $shipping_pak + MODULE_SHIPPING_FEDEXEU_HANDLING;
}
if ($shipping_pak != 0) {
$methods[] = array('id' => 'PAK', 'title' => 'FedEx Pak', 'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
}
}
if ($fedexeu_cost_env != '') {
$fedexeu_table_env = split("[:,]", $fedexeu_cost_env);
for ($i = 0; $i < sizeof($fedexeu_table_env); $i += 2) {
if ($shipping_weight <= $fedexeu_table_env[$i]) {
$shipping_env = $fedexeu_table_env[$i + 1];
break;
}
}
if ($shipping_env == -1) {
$shipping_cost = 0;
$shipping_method = MODULE_SHIPPING_FEDEXEU_UNDEFINED_RATE;
} else {
$shipping_cost_1 = $shipping_env + MODULE_SHIPPING_FEDEXEU_HANDLING;
}
if ($shipping_env != 0) {
$methods[] = array('id' => 'ENV', 'title' => 'FedEx Envelope', 'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
}
}
if ($fedexeu_cost_box != '') {
$fedexeu_table_box = split("[:,]", $fedexeu_cost_box);
if ($shipping_weight > 10 and $shipping_weight <= 20) {
$shipping_box = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_FEDEXEU_STEP_BOX_20_' . $j) + $fedexeu_table_box[count($fedexeu_table_box) - 1];
} elseif ($shipping_weight > 20 and $shipping_weight <= 40) {
$shipping_box = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_FEDEXEU_STEP_BOX_40_' . $j) + 20 * constant('MODULE_SHIPPING_FEDEXEU_STEP_BOX_20_' . $j) + $fedexeu_table_box[count($fedexeu_table_box) - 1];
} elseif ($shipping_weight > 40 and $shipping_weight <= 70) {
$shipping_box = number_format(($shipping_weight - 40) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_FEDEXEU_STEP_BOX_70_' . $j) + 20 * constant('MODULE_SHIPPING_FEDEXEU_STEP_BOX_20_' . $j) + 40 * constant('MODULE_SHIPPING_FEDEXEU_STEP_BOX_40_' . $j) + $fedexeu_table_box[count($fedexeu_table_box) - 1];
} else {
for ($i = 0; $i < sizeof($fedexeu_table_box); $i += 2) {
if ($shipping_weight <= $fedexeu_table_box[$i]) {
$shipping_box = $fedexeu_table_box[$i + 1];
break;
}
}
}
if ($shipping_box == -1) {
$shipping_cost = 0;
$shipping_method = MODULE_SHIPPING_FEDEXEU_UNDEFINED_RATE;
} else {
$shipping_cost_2 = $shipping_box + MODULE_SHIPPING_FEDEXEU_HANDLING;
}
if ($shipping_box != 0) {
$methods[] = array('id' => 'BOX', 'title' => 'FedEx Box', 'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
}
}
}
$this->quotes = array('id' => $this->code, 'module' => $this->title . LPAREN . $shipping_num_boxes . ' x ' . number_format($shipping_weight, CURRENCY_DECIMAL_PLACES, CURRENCY_DECIMAL_POINT, CURRENCY_THOUSANDS_POINT) . BLANK . MODULE_SHIPPING_FEDEXEU_TEXT_UNITS . RPAREN);
$this->quotes['methods'] = $methods;
if ($this->tax_class > 0) {
$this->quotes['tax'] = olc_get_tax_rate($this->tax_class, $order_delivery_country['id'], $order->delivery['zone_id']);
}
if (olc_not_null($this->icon)) {
$this->quotes['icon'] = olc_image($this->icon, $this->title);
}
//.........这里部分代码省略.........