本文整理汇总了PHP中smn_get_tax_rate函数的典型用法代码示例。如果您正苦于以下问题:PHP smn_get_tax_rate函数的具体用法?PHP smn_get_tax_rate怎么用?PHP smn_get_tax_rate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smn_get_tax_rate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quote
function quote($method = '')
{
global $order, $cart, $shipping_weight, $shipping_num_boxes, $store_id;
if (MODULE_SHIPPING_TABLE_MODE == 'price') {
$order_total = $cart->show_total($store_id);
} 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'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (smn_not_null($this->icon)) {
$this->quotes['icon'] = smn_image($this->icon, $this->title);
}
return $this->quotes;
}
示例2: process
function process()
{
global $order, $currencies;
if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
case 'national':
if ($order->delivery['country_id'] == $store->get_store_country()) {
$pass = true;
}
break;
case 'international':
if ($order->delivery['country_id'] != $store->get_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 = smn_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$tax_description = smn_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['tax'] += smn_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$order->info['tax_groups']["{$tax_description}"] += smn_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + smn_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(smn_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => smn_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax));
}
}
}
示例3: quote
function quote($method = '')
{
global $order;
$this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FREESHIPPER_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => '<FONT COLOR=FF0000><B>' . MODULE_SHIPPING_FREESHIPPER_TEXT_WAY . '</B></FONT>', 'cost' => SHIPPING_HANDLING + MODULE_SHIPPING_FREESHIPPER_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (smn_not_null($this->icon)) {
$this->quotes['icon'] = smn_image($this->icon, $this->title);
}
return $this->quotes;
}
示例4: quote
function quote($method = '')
{
global $order;
$this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_PICK_UP_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_PICK_UP_TEXT_WAY, 'cost' => MODULE_SHIPPING_PICK_UP_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (smn_not_null($this->icon)) {
$this->quotes['icon'] = smn_image($this->icon, $this->title);
}
return $this->quotes;
}
示例5: process
function process()
{
global $order, $currencies;
global $store;
if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
case 'national':
if ($order->delivery['country_id'] == $store->get_store_country()) {
$pass = true;
}
break;
case 'international':
if ($order->delivery['country_id'] != $store->get_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_SHIPPING_FREE_SHIPPING_OVER) {
$order->info['shipping_method'] = FREE_SHIPPING_TITLE;
$order->info['total'] -= $order->info['shipping_cost'];
$order->info['shipping_cost'] = 0;
}
}
$module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));
if (smn_not_null($order->info['shipping_method'])) {
if ($GLOBALS[$module]->tax_class > 0) {
$shipping_tax = smn_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
$shipping_tax_description = smn_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['tax'] += smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
$order->info['tax_groups']["{$shipping_tax_description}"] += smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
$order->info['total'] += smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$order->info['shipping_cost'] += smn_calculate_tax($order->info['shipping_cost'], $shipping_tax);
}
}
$this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['shipping_cost']);
}
}
示例6: array
}
$products_name .= ' </td>' .
' </tr>' .
'</table>';
$info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
'text' => $products_name);
$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => smn_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . smn_draw_hidden_field('products_id[]', $products[$i]['id']));
$info_box_contents[$cur_row][] = array('align' => 'right',
'params' => 'class="productListing-data" valign="top"',
'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], smn_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
$cart_total += ($products[$i]['final_price'] * $products[$i]['quantity']) ;
}
$tot += $cart_total;
new productListingBox($info_box_contents);
?></td></tr></table></td></tr>
<tr>
<td><?php
echo smn_draw_separator('pixel_trans.gif', '100%', '10');
?>
</td>
</tr>
<tr>
<td align="right" class="main"><b><?php
echo SUB_TITLE_TOTAL;
示例7: calculate
function calculate($store = '')
{
$this->total_virtual = 0;
$this->total = 0;
$this->weight = 0;
if (!is_array($this->contents)) {
return 0;
}
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$qty = $this->contents[$products_id]['qty'];
// products price
$product_query = smn_db_query("select products_model, products_tax_class_id, products_price, store_id, products_price, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "' LIMIT 1");
if ($product = smn_db_fetch_array($product_query)) {
$products_price = $product['products_price'];
//SW Fix 9-17-2007 : Consider Special Price
$products_tax = smn_get_tax_rate($product['products_tax_class_id']);
$no_count = 1;
$products_weight = $product['products_weight'];
//SW Fix 10-1-2007 : Shipping Weight Fix
$products_store_id = $product['store_id'];
//SW Fix 10-1-2007 : Shipping Weight Fix
if (ereg('^GIFT', $gv_result['products_model'])) {
$no_count = 0;
}
$specials_query = smn_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int) $products_id . "' and status = '1' and store_id = '" . (int) $product['store_id'] . "' LIMIT 1");
if (smn_db_num_rows($specials_query)) {
$specials = smn_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
if (isset($store) && $store != '') {
if ($products_store_id == $store) {
$this->total_virtual += smn_add_tax($products_price, $products_tax) * $qty * $no_count;
//SW Fix 9-17-2007 : Consider Special Price
$this->weight_virtual += $qty * $products_weight * $no_count;
$this->total += smn_add_tax($products_price, $products_tax) * $qty;
//SW Fix 9-17-2007 : Consider Special Price
$this->weight += $qty * $products_weight;
//SW Fix 10-1-2007 : Shipping Weight Fix
}
} else {
$this->total_virtual += smn_add_tax($products_price, $products_tax) * $qty * $no_count;
//SW Fix 9-17-2007 : Consider Special Price
$this->weight_virtual += $qty * $products_weight * $no_count;
//SW Fix 10-1-2007 : Shipping Weight Fix
$this->total += smn_add_tax($products_price, $products_tax) * $qty;
//SW Fix 9-17-2007 : Consider Special Price
$this->weight += $qty * $products_weight;
//SW Fix 10-1-2007 : Shipping Weight Fix
}
}
// attributes price
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
$attribute_price_query = smn_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $products_id . "' and options_id = '" . (int) $option . "' and store_id = '" . $products_store_id . "' and options_values_id = '" . (int) $value . "' LIMIT 1");
$attribute_price = smn_db_fetch_array($attribute_price_query);
if ($attribute_price['price_prefix'] == '+') {
$this->total += $qty * smn_add_tax($attribute_price['options_values_price'], $products_tax);
} else {
$this->total -= $qty * smn_add_tax($attribute_price['options_values_price'], $products_tax);
}
}
}
}
}
示例8: array
echo $products_options_name['products_options_comment'];
if ($products_attribs_array['options_values_price'] != '0') {
echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], $product_info_values['products_tax_class_id']) . ') ';
}
echo '</td></tr>';
break;
default:
//clr 030714 default is select list
//clr 030714 reset selected_attribute variable
$selected_attribute = false;
$products_options_array = array();
$products_options_query = smn_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int) $_GET['products_id'] . "' and pa.options_id = '" . (int) $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int) $languages_id . "'");
while ($products_options = smn_db_fetch_array($products_options_query)) {
$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
if ($products_options['options_values_price'] != '0') {
$products_options_array[sizeof($products_options_array) - 1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], smn_get_tax_rate($product_info['products_tax_class_id'])) . ') ';
}
}
if (isset($cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']])) {
$selected_attribute = $cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']];
} else {
$selected_attribute = false;
}
?>
<tr>
<td class="main"><?php
echo $products_options_name['products_options_name'] . ':';
?>
</td>
<td class="main"><?php
echo smn_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . $products_options_name['products_options_comment'];
示例9: number_format
// Tax (not in shopping cart, tax rate may be unknown)
if (!strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {
echo ' <td align="center" valign="top" class="main">' . number_format($products[$i]['tax'], TAX_DECIMAL_PLACES) . '%</td>' . "\n";
}
// Product price
if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
echo ' <td align="right" valign="top" class="main"><b>' . $currencies->display_price($products[$i]['price'], smn_get_tax_rate($products[$i]['tax_class_id'], '', '', $products[$i]['store_id']), $products[$i]['quantity']) . '</b>';
} else {
echo ' <td align="right" valign="top" class="main"><b>' . $currencies->display_price($products[$i]['price'], $products[$i]['tax'], $products[$i]['quantity']) . '</b>';
}
// Product options prices
if ($attributes_exist == 1) {
reset($products[$i]['attributes']);
while (list($option, $value) = each($products[$i]['attributes'])) {
if ($products[$i][$option]['options_values_price'] != 0) {
if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
echo '<br><small><i>' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], smn_get_tax_rate($products[$i]['tax_class_id'], '', '', $products[$i]['store_id']), $products[$i]['quantity']) . '</i></small>';
} else {
echo '<br><small><i>' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], $products[$i]['tax'], $products[$i]['quantity']) . '</i></small>';
}
} else {
// Keep price aligned with corresponding option
echo '<br><small><i> </i></small>';
}
}
}
echo '</td>' . "\n" . ' </tr>' . "\n";
}
?>
<!-- order_details_eof -->
示例10: contentBoxHeading
new contentBoxHeading($info_box_contents);
$row = 0;
$col = 0;
$info_box_contents = array();
while ($xsell = smn_db_fetch_array($xsell_query)) {
$xsell['specials_new_products_price'] = smn_get_products_special_price($xsell['products_id']);
$store_images = 'images/' . $xsell['store_id'] . '_images/';
if ($xsell['specials_new_products_price']) {
$xsell_price = '<s>' . $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</s><br>';
$xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</span>';
} else {
$xsell_price = $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id']));
}
$info_box_contents[$row][$col] = array('text' => '<TABLE><TR><TD align="center" class="infoBoxContents" width="100"><div align="left">
<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $xsell['store_id'] . '&products_id=' . $xsell['products_id']) . '">' . smn_image($store_images . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></TD><TD class="infoBoxContents">
<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $xsell['store_id'] . '&products_id=' . $xsell['products_id']) . '</a><br>' . TEXT_PRICE_SOLO . '<br>' . $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</div></td></tr></table>');
$col++;
if ($col > 0) {
$col = 0;
$row++;
}
}
new contentBox($info_box_contents);
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left', 'text' => ' ');
new infoBoxDefault($info_box_contents, true, true);
?>
<!-- xsell_products_eof //-->
示例11: get_product_price
function get_product_price($product_id)
{
global $cart, $order;
$products_id = smn_get_prid($product_id);
// products price
$qty = $cart->contents[$product_id]['qty'];
$product_query = smn_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . $product_id . "'");
if ($product = smn_db_fetch_array($product_query)) {
$prid = $product['products_id'];
$products_tax = smn_get_tax_rate($product['products_tax_class_id']);
$products_price = $product['products_price'];
$specials_query = smn_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'");
if (smn_db_num_rows($specials_query)) {
$specials = smn_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
if ($this->include_tax == 'true') {
$total_price += ($products_price + smn_calculate_tax($products_price, $products_tax)) * $qty;
} else {
$total_price += $products_price * $qty;
}
// attributes price
if (isset($cart->contents[$product_id]['attributes'])) {
reset($cart->contents[$product_id]['attributes']);
while (list($option, $value) = each($cart->contents[$product_id]['attributes'])) {
$attribute_price_query = smn_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'");
$attribute_price = smn_db_fetch_array($attribute_price_query);
if ($attribute_price['price_prefix'] == '+') {
if ($this->include_tax == 'true') {
$total_price += $qty * ($attribute_price['options_values_price'] + smn_calculate_tax($attribute_price['options_values_price'], $products_tax));
} else {
$total_price += $qty * $attribute_price['options_values_price'];
}
} else {
if ($this->include_tax == 'true') {
$total_price -= $qty * ($attribute_price['options_values_price'] + smn_calculate_tax($attribute_price['options_values_price'], $products_tax));
} else {
$total_price -= $qty * $attribute_price['options_values_price'];
}
}
}
}
}
if ($this->include_shipping == 'true') {
$total_price += $order->info['shipping_cost'];
}
return $total_price;
}
示例12: smn_draw_separator
<TD style="padding-left: 8px;">
<TABLE border="0" width="100%" cellspacing="0" cellpadding="0">
<TR>
<TD style="' . $style1 . '">' . smn_draw_separator('pixel_trans.gif', '100%', '7') . '</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD style="' . $style2 . 'padding-left: 7px;">
<SPAN CLASS="priceNew">' . $currencies->display_price($new_products['products_price'], smn_get_tax_rate($new_products['products_tax_class_id'])) . '</SPAN><br>
' . smn_draw_hidden_field('products_id', $new_products['products_id']) . smn_image_submit('add_to_cart.gif', IMAGE_BUTTON_IN_CART) . '<br>
<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $new_products['store_id'] . '&products_id=' . $new_products['products_id']) . '">' . smn_image(DIR_WS_CATALOG_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a class="prodNameNew" href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $new_products['store_id'] . '&products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $new_products['products_description'] . '
</TD>
</TR>
</TABLE>
</FORM>');
$nr++;
$col++;
if ($col > 1) {
$col = 0;
$row++;
}
}
new contentBox($info_box_contents);
?>
示例13: osc_trunc_string
}
break;
case 'MASTER_LIST_DESCRIPTION':
$lc_align = '';
$lc_text = ' ' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), MASTER_LIST_DESCRIPTION_LENGTH) . ' ';
break;
case 'MASTER_LIST_MANUFACTURER':
$lc_align = '';
$lc_text = ' <a href="' . smn_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
break;
case 'MASTER_LIST_PRICE':
$lc_align = 'right';
if (smn_not_null($listing['specials_new_products_price'])) {
$lc_text = ' <s>' . $currencies->display_price($listing['products_price'], smn_get_tax_rate($listing['products_tax_class_id'], '', '', $listing['store_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], smn_get_tax_rate($listing['products_tax_class_id'], '', '', $listing['store_id'])) . '</span> ';
} else {
$lc_text = ' ' . $currencies->display_price($listing['products_price'], smn_get_tax_rate($listing['products_tax_class_id'], '', '', $listing['store_id'])) . ' ';
}
break;
case 'MASTER_LIST_QUANTITY':
$lc_align = 'center';
$lc_text = ' ' . $listing['products_quantity'] . ' ';
break;
case 'MASTER_LIST_WEIGHT':
$lc_align = 'right';
$lc_text = ' ' . $listing['products_weight'] . ' ';
break;
case 'MASTER_LIST_IMAGE':
$lc_align = 'center';
if (isset($_GET['manufacturers_id'])) {
$lc_text = '<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . smn_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
} else {
示例14: quote_store
function quote_store($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes, $transittime, $cart;
if (smn_not_null($method) && (isset($this->types[$method]) || in_array($method, $this->intl_types))) {
$this->_setService($method);
}
$this->_setContainer('None');
$this->_setSize('REGULAR');
// usps doesnt accept zero weight
$shipping_weight = $shipping_weight < 0.1 ? 0.1 : $shipping_weight;
$shipping_pounds = floor($shipping_weight);
$shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
$this->_setWeight($shipping_pounds, $shipping_ounces);
// Added by Kevin Chen (kkchen@uci.edu); Fixes the Parcel Post Bug July 1, 2004
// Refer to http://www.usps.com/webtools/htm/Domestic-Rates.htm documentation
// Thanks Ryan
if ($shipping_pounds > 35 || $shipping_pounds == 0 && $shipping_ounces < 6) {
$this->_setMachinable('False');
} else {
$this->_setMachinable('True');
}
// End Kevin Chen July 1, 2004
if (in_array('Display weight', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) {
$shiptitle = ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)';
} else {
$shiptitle = '';
}
$store_list = $cart->get_store_list();
for ($k = 0; $k < sizeof($store_list); $k++) {
define('SHIPPING_ORIGIN_COUNTRY', $cart->get_cart_store_country($store_list[$k]));
define('SHIPPING_ORIGIN_ZIP', $cart->get_cart_store_zip($store_list[$k]));
define('STORE_ORIGIN_ZIP', $cart->get_cart_store_zip($store_list[$k]));
$uspsQuote[$store_list[$k]] = $this->_getQuote();
}
foreach ($uspsQuote as $key => $value) {
if (is_array($value)) {
if (isset($value['error'])) {
$this->quotes_store[$key] = array('module' => $this->title, 'error' => $value['error']);
} else {
$this->quotes_store[$key] = array('id' => $this->code, 'module' => $this->title . $shiptitle);
$methods = array();
$size = sizeof($value);
for ($i = 0; $i < $size; $i++) {
list($type, $cost) = each($value[$i]);
$title = isset($this->types[$type]) ? $this->types[$type] : $type;
if (in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) {
$title .= $transittime[$type];
}
$methods[] = array('id' => $type, 'title' => $title, 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
$this->quotes_store[$key]['methods'] = $methods;
if ($this->tax_class > 0) {
$this->quotes_store[$key]['tax'] = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
}
} else {
$this->quotes_store[$key] = array('module' => $this->title, 'error' => MODULE_SHIPPING_USPS_TEXT_ERROR);
}
if (smn_not_null($this->icon)) {
$this->quotes_store[$key]['icon'] = smn_image($this->icon, $this->title);
}
}
return $this->quotes_store;
}
示例15: calculate_tax_deduction
function calculate_tax_deduction($amount, $od_amount, $method)
{
global $order;
switch ($method) {
case 'Standard':
$ratio1 = $amount == 0 ? 0 : smn_round($od_amount / $amount, 2);
$tod_amount = 0;
reset($order->info['tax_groups']);
while (list($key, $value) = each($order->info['tax_groups'])) {
$tax_rate = smn_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 = smn_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 = smn_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
$tax_desc = smn_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;
break;
default:
}
return $tod_amount;
}