本文整理汇总了PHP中mslib_fe::taxRuleSet方法的典型用法代码示例。如果您正苦于以下问题:PHP mslib_fe::taxRuleSet方法的具体用法?PHP mslib_fe::taxRuleSet怎么用?PHP mslib_fe::taxRuleSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mslib_fe
的用法示例。
在下文中一共展示了mslib_fe::taxRuleSet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
} else {
$shipping_tax['shipping_tax'] = 0;
$shipping_tax['shipping_country_tax'] = 0;
$shipping_tax['shipping_region_tax'] = 0;
$shipping_tax['shipping_total_tax_rate'] = 0;
$shipping_tax['shipping_country_tax_rate'] = 0;
$shipping_tax['shipping_region_tax_rate'] = 0;
}
$updateArray['shipping_method'] = $shipping_method['code'];
$updateArray['shipping_method_label'] = $shipping_method['name'];
}
if ($this->post['payment_method']) {
$payment_method = mslib_fe::getPaymentMethod($this->post['payment_method']);
if (empty($order['orders_tax_data'])) {
// temporary call, replacing the inner tax_ruleset inside the getPaymentMethod
$tax_ruleset = mslib_fe::taxRuleSet($payment_method['tax_id'], 0, $country['cn_iso_nr'], $zone['zn_country_iso_nr']);
$payment_method['tax_rate'] = $tax_ruleset['total_tax_rate'] / 100;
$payment_method['country_tax_rate'] = $tax_ruleset['country_tax_rate'] / 100;
$payment_method['region_tax_rate'] = $tax_ruleset['state_tax_rate'] / 100;
}
if ($this->post['tx_multishop_pi1']['payment_method_costs']) {
$price = $this->post['tx_multishop_pi1']['payment_method_costs'];
} else {
$price = $payment_method['handling_costs'];
}
$updateArray['payment_method_costs'] = $price;
if ($payment_method['tax_id'] && $updateArray['payment_method_costs']) {
$payment_tax['payment_total_tax_rate'] = $payment_method['tax_rate'];
if ($payment_method['country_tax_rate']) {
$payment_tax['payment_country_tax_rate'] = $payment_method['country_tax_rate'];
$payment_tax['payment_country_tax'] = mslib_fe::taxDecimalCrop($updateArray['payment_method_costs'] * $payment_method['country_tax_rate']);
示例2: countCartTotalTax
function countCartTotalTax($country_id = 0)
{
$total_product_tax = 0;
$products_tax = array();
//$cart=$GLOBALS['TSFE']->fe_user->getKey('ses', $this->cart_page_uid);
require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.tx_mslib_cart.php';
$mslib_cart = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_mslib_cart');
$mslib_cart->init($this);
$cart = $mslib_cart->getCart();
$address = $cart['user'];
if (is_array($cart['products']) && count($cart['products'])) {
foreach ($cart['products'] as $shopping_cart_item => $value) {
if ($country_id > 0) {
$tax_rate = mslib_fe::taxRuleSet($value['tax_id'], 0, $country_id, 0);
$value['tax_rate'] = $tax_rate['total_tax_rate'] / 100;
}
if (is_numeric($value['products_id'])) {
$product_amount = $value['final_price'];
$subtotal_price = $value['qty'] * $product_amount;
if ($value['tax_rate']) {
$total_product_tax += $subtotal_price * $value['tax_rate'];
}
// attributes
if (is_array($value['attributes'])) {
foreach ($value['attributes'] as $attribute_key => $attribute_value) {
$total_product_tax += $attribute_value['options_values_price'] * $value['qty'] * $value['tax_rate'];
}
}
// attributes eof
$products_tax['products_tax']['products_tax_rate_' . $value['products_id']] = $value['tax_rate'];
}
}
}
$products_tax['total_tax'] = $total_product_tax;
return $products_tax;
}
示例3: microtime
$global_start_time = microtime(true);
$start_time = microtime(true);
$total_datarows = count($rows);
if ($this->msLogFile) {
if ($total_datarows) {
// sometimes the preload takes so long that the database connection is lost.
$GLOBALS['TYPO3_DB']->connectDB();
file_put_contents($this->msLogFile, $this->HTTP_HOST . ' - products loaded, now starting the import. (' . date("Y-m-d G:i:s") . ")\n", FILE_APPEND);
} else {
file_put_contents($this->msLogFile, $this->HTTP_HOST . ' - no products needed to be imported' . "\n", FILE_APPEND);
}
}
// load default TAX rules
if ($this->post['tx_multishop_pi1']['default_vat_rate']) {
$default_iso_customer = mslib_fe::getCountryByName($this->tta_shop_info['country']);
$default_tax_rate = mslib_fe::taxRuleSet($this->post['tx_multishop_pi1']['default_vat_rate'], 0, $default_iso_customer['cn_iso_nr'], 0);
}
// custom hook that can be controlled by third-party plugin
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_import.php']['iteratorPreProc'])) {
$params = array('rows' => &$rows, 'prefix_source_name' => $this->post['prefix_source_name']);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_import.php']['iteratorPreProc'] as $funcRef) {
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
}
}
// custom hook that can be controlled by third-party plugin eof
foreach ($rows as $row) {
$skipRow = 0;
// custom hook that can be controlled by third-party plugin
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_import.php']['itemIteratePreProc'])) {
$params = array('row' => &$row, 'prefix_source_name' => $this->post['prefix_source_name'], 'skipRow' => &$skipRow);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/admin_pages/admin_import.php']['itemIteratePreProc'] as $funcRef) {
示例4: repairOrder
function repairOrder($orders_id)
{
if (is_numeric($orders_id)) {
$this->conf['order_id'] = (int) $orders_id;
$tax_separation = array();
$sql = "select orders_id, orders_tax_data, payment_method_costs, shipping_method_costs, discount, shipping_method, payment_method, billing_region, billing_country, billing_vat_id from tx_multishop_orders where orders_id='" . $orders_id . "' order by orders_id asc";
$qry = $GLOBALS['TYPO3_DB']->sql_query($sql);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
$sub_total_tax = 0;
$sub_total = 0;
$sub_total_excluding_vat = 0;
$shipping_tax = 0;
$payment_tax = 0;
$grand_total = 0;
$order_tax_data['shipping_tax'] = '0';
$order_tax_data['shipping_country_tax'] = '0';
$order_tax_data['shipping_region_tax'] = '0';
$order_tax_data['shipping_total_tax_rate'] = '0';
$order_tax_data['shipping_country_tax_rate'] = '0';
$order_tax_data['shipping_region_tax_rate'] = '0';
$order_tax_data['payment_tax'] = '0';
$order_tax_data['payment_country_tax'] = '0';
$order_tax_data['payment_region_tax'] = '0';
$order_tax_data['payment_total_tax_rate'] = '0';
$order_tax_data['payment_country_tax_rate'] = '0';
$order_tax_data['payment_region_tax_rate'] = '0';
$order_tax_data['grand_total'] = '0';
$order_tax_data['total_orders_tax'] = '0';
// get shipping method by code
$this->tta_user_info['default']['country'] = $row['billing_country'];
$iso_customer = mslib_fe::getCountryByName($this->tta_user_info['default']['country']);
$iso_customer['country'] = $iso_customer['cn_short_en'];
// if store country is different from customer country and user provided valid VAT id, change VAT rate to zero
//$this->ms['MODULES']['DISABLE_VAT_RATE']=0;
if (!$this->ms['MODULES']['DISABLE_VAT_RATE'] && $this->ms['MODULES']['DISABLE_VAT_FOR_FOREIGN_CUSTOMERS_WITH_COMPANY_VAT_ID'] and $row['billing_vat_id']) {
if (strtolower($row['billing_country']) != strtolower($this->tta_shop_info['country'])) {
$this->ms['MODULES']['DISABLE_VAT_RATE'] = 1;
}
}
// get shipping tax rate
$shipping_method = mslib_fe::getShippingMethod($row['shipping_method'], 's.code', $iso_customer['cn_iso_nr']);
$tax_rate = mslib_fe::taxRuleSet($shipping_method['tax_id'], 0, $iso_customer['cn_iso_nr'], 0);
if (!$tax_rate['total_tax_rate']) {
$tax_rate['total_tax_rate'] = $this->ms['MODULES']['INCLUDE_VAT_OVER_METHOD_COSTS'];
}
if ($this->ms['MODULES']['DISABLE_VAT_RATE']) {
$tax_rate['total_tax_rate'] = 0;
}
$shipping_tax_rate = $tax_rate['total_tax_rate'] / 100;
// get payment tax rate
$payment_method = mslib_fe::getPaymentMethod($row['payment_method'], 'p.code', $iso_customer['cn_iso_nr']);
$tax_rate = mslib_fe::taxRuleSet($payment_method['tax_id'], 0, $iso_customer['cn_iso_nr'], 0);
if (!$tax_rate['total_tax_rate']) {
$tax_rate['total_tax_rate'] = $this->ms['MODULES']['INCLUDE_VAT_OVER_METHOD_COSTS'];
}
if ($this->ms['MODULES']['DISABLE_VAT_RATE']) {
$tax_rate['total_tax_rate'] = 0;
}
$payment_tax_rate = $tax_rate['total_tax_rate'] / 100;
if ($shipping_tax_rate > 0 or $payment_tax_rate > 0) {
// disable rounding to prevent cents short issue
$shipping_tax = $row['shipping_method_costs'] * $shipping_tax_rate;
$payment_tax = $row['payment_method_costs'] * $payment_tax_rate;
/*if (!$this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] || $this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT']) {
$shipping_tax=round($row['shipping_method_costs']*$shipping_tax_rate, 2);
$payment_tax=round($row['payment_method_costs']*$payment_tax_rate, 2);
} else {
$shipping_tax=$row['shipping_method_costs']*$shipping_tax_rate;
$payment_tax=$row['payment_method_costs']*$payment_tax_rate;
}*/
$order_tax_data['shipping_total_tax_rate'] = (string) number_format($shipping_tax_rate, 2, '.', ',');
$order_tax_data['payment_total_tax_rate'] = (string) number_format($payment_tax_rate, 2, '.', ',');
$order_tax_data['shipping_tax'] = (string) $shipping_tax;
$order_tax_data['payment_tax'] = (string) $payment_tax;
//$total_tax+=$shipping_tax+$payment_tax;
//$grand_total+=(($row['shipping_method_costs']+$row['payment_method_costs'])+($shipping_tax+$payment_tax));
} else {
//$grand_total+=($row['shipping_method_costs']+$row['payment_method_costs']);
}
$tax_separation[$shipping_tax_rate * 100]['shipping_tax'] += $shipping_tax;
$tax_separation[$payment_tax_rate * 100]['payment_tax'] += $payment_tax;
$tax_separation[$shipping_tax_rate * 100]['shipping_costs'] = $row['shipping_method_costs'];
$tax_separation[$payment_tax_rate * 100]['payment_costs'] = $row['payment_method_costs'];
//
$product_tax_data['country_tax_rate'] = '0';
$product_tax_data['region_tax_rate'] = '0';
$product_tax_data['total_tax_rate'] = '0';
$product_tax_data['country_tax'] = '0';
$product_tax_data['region_tax'] = '0';
$product_tax_data['total_tax'] = '0';
$product_tax_data['total_attributes_tax'] = '0';
$sql_prod = "select * from tx_multishop_orders_products where orders_id = " . $row['orders_id'];
$qry_prod = $GLOBALS['TYPO3_DB']->sql_query($sql_prod);
while ($row_prod = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_prod)) {
$tax_rate = $row_prod['products_tax'] / 100;
$product_tax = unserialize($row_prod['products_tax_data']);
// attributes tax
$sql_attr = "select * from tx_multishop_orders_products_attributes where orders_products_id = " . $row_prod['orders_products_id'] . " and orders_id = " . $row_prod['orders_id'];
$qry_attr = $GLOBALS['TYPO3_DB']->sql_query($sql_attr);
$attributes_tax = 0;
//.........这里部分代码省略.........
示例5: array
$payment_methods = $payment_methods_group;
} else {
$payment_methods = $payment_methods_product;
}
}
if (!count($payment_methods)) {
// nothing is loaded. this cant be valid so let's load the default methods.
// load payment method based on store origin country
$payment_methods = mslib_fe::loadPaymentMethods(0, $countries_id, true, true);
}
$data = array();
$k = 0;
foreach ($payment_methods as $payment_name => $payment_data) {
$vars = unserialize($payment_data['vars']);
if ($countries_id > 0) {
$tax_ruleset = mslib_fe::taxRuleSet($payment_data['tax_id'], 0, $countries_id, 0);
} else {
$tax_ruleset = mslib_fe::getTaxRuleSet($payment_data['tax_id'], 0);
}
$payment_data['tax_rate'] = $tax_ruleset['total_tax_rate'] / 100;
//print_r($payment_data);
if (!$tr_type or $tr_type == 'even') {
$tr_type = 'odd';
} else {
$tr_type = 'even';
}
if (!$payment_data['sort_order']) {
$payment_data['sort_order'] = $k;
}
// refine the payment data, only sent what it's need to rebuild the <li> on the client side
$data[$payment_data['sort_order']]['payment_id'] = $payment_data['id'];
示例6: unserialize
//echo '<pre>';
//print_r($order_products_table);
//die();
// $tmpcontent.='<tr><td colspan="'.$colspan.'"><hr class="hr"></td></tr>';
$orders_tax_data = unserialize($orders['orders_tax_data']);
$tmpcontent .= '<tfoot><tr><td colspan="' . $colspan . '" class="order_total_data text-right">';
if ($this->ms['MODULES']['ORDER_EDIT'] and $settings['enable_edit_orders_details']) {
$iso_customer = mslib_fe::getCountryByName($orders['billing_country']);
$iso_customer['country'] = $iso_customer['cn_short_en'];
//
$payment_method = mslib_fe::getPaymentMethod($orders['payment_method'], 'p.code', $iso_customer['cn_iso_nr']);
$shipping_method = mslib_fe::getShippingMethod($orders['shipping_method'], 's.code', $iso_customer['cn_iso_nr']);
//
if ($iso_customer['cn_iso_nr'] > 0) {
$payment_tax_ruleset = mslib_fe::taxRuleSet($payment_method['tax_id'], 0, $iso_customer['cn_iso_nr'], 0);
$shipping_tax_ruleset = mslib_fe::taxRuleSet($shipping_method['tax_id'], 0, $iso_customer['cn_iso_nr'], 0);
if (!$payment_tax_ruleset) {
$payment_method['tax_id'] = 0;
}
if (!$shipping_tax_ruleset) {
$shipping_method['tax_id'] = 0;
}
}
if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
$shipping_costs = '<div class="input-group pull-right" style="width:140px;">
<span class="input-group-addon">' . mslib_fe::currency() . '</span>
<input name="tx_multishop_pi1[shipping_method_costs]" id="shipping_method_costs" type="text" class="form-control text-right priceInputDisplay" value="' . number_format($orders['shipping_method_costs'] + $orders_tax_data['shipping_tax'], 4, $this->ms['MODULES']['CUSTOMER_CURRENCY_ARRAY']['cu_decimal_point'], '') . '" class="align_right" />
<input type="hidden" id="hidden_shipping_tax" value="' . $orders_tax_data['shipping_tax'] . '">
</div>';
$payment_costs = '<div class="input-group pull-right" style="width:140px;">
<span class="input-group-addon">' . mslib_fe::currency() . '</span>