当前位置: 首页>>代码示例>>PHP>>正文


PHP mslib_fe::countCartTotalPrice方法代码示例

本文整理汇总了PHP中mslib_fe::countCartTotalPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP mslib_fe::countCartTotalPrice方法的具体用法?PHP mslib_fe::countCartTotalPrice怎么用?PHP mslib_fe::countCartTotalPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mslib_fe的用法示例。


在下文中一共展示了mslib_fe::countCartTotalPrice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setPaymentMethod

 function setPaymentMethod($payment_method)
 {
     if (!$payment_method) {
         return 0;
     }
     $payment_method = mslib_fe::getPaymentMethod($payment_method);
     $iso_customer = mslib_fe::getCountryByName($this->cart['user']['country']);
     $countries_id = $iso_customer['cn_iso_nr'];
     if ($payment_method['handling_costs']) {
         if (!strstr($payment_method['handling_costs'], "%")) {
             $this->cart['user']['payment_method_costs'] = $payment_method['handling_costs'];
         } else {
             // calculate total payment costs based by %
             if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                 $subtotal = $this->cart['summarize']['sub_total_including_vat'] - $this->cart['discount_amount'];
             } else {
                 $subtotal = $this->cart['summarize']['sub_total'] - $this->cart['discount_amount'];
             }
             if ($subtotal) {
                 if (strstr($payment_method['handling_costs'], "%")) {
                     $percentage = str_replace("%", '', $payment_method['handling_costs']);
                     $total_include_vat = 0;
                     if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                         $total_include_vat = 1;
                     }
                     $subtotal = mslib_fe::countCartTotalPrice(1, $total_include_vat, $countries_id);
                     if ($subtotal) {
                         $handling_cost = $subtotal / 100 * $percentage;
                         if ($total_include_vat && $payment_method['tax_rate']) {
                             $handling_cost = $handling_cost / (1 + $payment_method['tax_rate']);
                         }
                         $this->cart['user']['payment_method_costs'] = $handling_cost;
                     }
                 } else {
                     $this->cart['user']['payment_method_costs'] = $payment_method['handling_costs'];
                 }
             }
         }
     } else {
         $this->cart['user']['payment_method_costs'] = 0;
     }
     if ($payment_method['tax_id'] && $this->cart['user']['payment_method_costs']) {
         $this->cart['user']['payment_total_tax_rate'] = $payment_method['tax_rate'];
         //if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
         //$this->cart['user']['payment_method_costs']=$this->cart['user']['payment_method_costs']-($this->cart['user']['payment_method_costs']*$this->cart['user']['payment_total_tax_rate']);
         //}
         if ($payment_method['country_tax_rate']) {
             $this->cart['user']['payment_country_tax_rate'] = $payment_method['country_tax_rate'];
             $this->cart['user']['payment_country_tax'] = mslib_fe::taxDecimalCrop($this->cart['user']['payment_method_costs'] * $payment_method['country_tax_rate']);
         } else {
             $this->cart['user']['payment_country_tax_rate'] = 0;
             $this->cart['user']['payment_country_tax'] = 0;
         }
         if ($payment_method['region_tax_rate']) {
             $this->cart['user']['payment_region_tax_rate'] = $payment_method['region_tax_rate'];
             $this->cart['user']['payment_region_tax'] = mslib_fe::taxDecimalCrop($this->cart['user']['payment_method_costs'] * $payment_method['region_tax_rate']);
         } else {
             $this->cart['user']['payment_region_tax_rate'] = 0;
             $this->cart['user']['payment_region_tax'] = 0;
         }
         if ($this->cart['user']['payment_region_tax'] && $this->cart['user']['payment_country_tax']) {
             $this->cart['user']['payment_tax'] = $this->cart['user']['payment_country_tax'] + $this->cart['user']['payment_region_tax'];
         } else {
             $this->cart['user']['payment_tax'] = $this->cart['user']['payment_method_costs'] * $payment_method['tax_rate'];
         }
     } else {
         $this->cart['user']['payment_tax'] = 0;
         $this->cart['user']['payment_country_tax'] = 0;
         $this->cart['user']['payment_region_tax'] = 0;
         $this->cart['user']['payment_total_tax_rate'] = 0;
         $this->cart['user']['payment_country_tax_rate'] = 0;
         $this->cart['user']['payment_region_tax_rate'] = 0;
     }
     $this->cart['user']['payment_method'] = $payment_method['code'];
     $this->cart['user']['payment_method_label'] = $payment_method['name'];
     // payment eof
     // hook to rewrite the whole methods
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['setPaymentMethodPreSaveHook'])) {
         $params = array('cart_user' => &$this->cart['user']);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.tx_mslib_cart.php']['setPaymentMethodPreSaveHook'] as $funcRef) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     }
     tx_mslib_cart::storeCart($this->cart);
 }
开发者ID:bvbmedia,项目名称:multishop,代码行数:85,代码来源:class.tx_mslib_cart.php

示例2: foreach

     $return_data['shipping_cost'] = 0;
     $return_data['shipping_costs_display'] = mslib_fe::amount2Cents(0);
     $return_data['shipping_method']['deliver_by'] = '';
     $return_data['shopping_cart_total_price'] = mslib_fe::amount2Cents(mslib_fe::countCartTotalPrice(1, $count_cart_incl_vat, $iso_customer['cn_iso_nr']));
     //
     foreach ($shipping_cost_data as $shipping_code => $shipping_cost) {
         if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
             $count_cart_incl_vat = 1;
             $return_data['shipping_cost'] = $shipping_cost['shipping_costs_including_vat'];
             $return_data['shipping_costs_display'] = mslib_fe::amount2Cents($shipping_cost['shipping_costs_including_vat']);
         } else {
             $return_data['shipping_cost'] = $shipping_cost['shipping_costs'];
             $return_data['shipping_costs_display'] = mslib_fe::amount2Cents($shipping_cost['shipping_costs']);
         }
         $return_data['shipping_method'] = $shipping_cost;
         $return_data['shopping_cart_total_price'] = mslib_fe::amount2Cents(mslib_fe::countCartTotalPrice(1, $count_cart_incl_vat, $iso_customer['cn_iso_nr']) + $return_data['shipping_cost']);
     }
     echo json_encode($return_data);
     exit;
     break;
 case 'get_product_shippingcost_overview':
     if (is_numeric($this->post['tx_multishop_pi1']['pid'])) {
         $return_data = array();
         $product_data = mslib_fe::getProduct($this->post['tx_multishop_pi1']['pid']);
         if (!$this->post['tx_multishop_pi1']['qty']) {
             $this->post['tx_multishop_pi1']['qty'] = 1;
         }
         $return_data['delivery_time'] = 'e';
         if (!empty($product_data['delivery_time'])) {
             $return_data['delivery_time'] = trim($product_data['delivery_time']);
         }
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:core.php

示例3: getShippingCosts

 public function getShippingCosts($countries_id, $shipping_method_id)
 {
     if (!is_numeric($countries_id)) {
         return false;
     }
     if (!is_numeric($shipping_method_id)) {
         return false;
     }
     $str3 = $GLOBALS['TYPO3_DB']->SELECTquery('sm.shipping_costs_type, sm.handling_costs, c.price, c.override_shippingcosts, c.zone_id', 'tx_multishop_shipping_methods sm, tx_multishop_shipping_methods_costs c, tx_multishop_countries_to_zones c2z', 'sm.id=c.shipping_method_id and c.zone_id=c2z.zone_id and c.shipping_method_id=\'' . $shipping_method_id . '\' and (sm.page_uid=0 or sm.page_uid=\'' . $this->shop_pid . '\') and c2z.cn_iso_nr=\'' . $countries_id . '\'', '', '', '');
     $qry3 = $GLOBALS['TYPO3_DB']->sql_query($str3);
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry3)) {
         $row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry3);
         $shipping_method = mslib_fe::getShippingMethod($shipping_method_id, 's.id', $countries_id);
         //hook to let other plugins further manipulate the settings
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getShippingCosts'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getShippingCosts'] as $funcRef) {
                 $params['row3'] =& $row3;
                 $params['shipping_method'] =& $shipping_method;
                 $params['countries_id'] =& $countries_id;
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         if ($row3['shipping_costs_type'] == 'weight') {
             $total_weight = mslib_fe::countCartWeight();
             $steps = explode(",", $row3['price']);
             $current_price = '';
             foreach ($steps as $step) {
                 $cols = explode(":", $step);
                 if (isset($cols[1])) {
                     $current_price = $cols[1];
                 }
                 if ($total_weight <= $cols[0]) {
                     $current_price = $cols[1];
                     break;
                 }
             }
             $shipping_cost = $current_price;
             $shipping_cost_method_box = $current_price;
         } elseif ($row3['shipping_costs_type'] == 'quantity') {
             $total_quantity = mslib_fe::countCartQuantity();
             $steps = explode(",", $row3['price']);
             $current_price = '';
             foreach ($steps as $step) {
                 $cols = explode(":", $step);
                 if (isset($cols[1])) {
                     $current_price = $cols[1];
                 }
                 if ($total_quantity <= $cols[0]) {
                     $current_price = $cols[1];
                     break;
                 }
             }
             $shipping_cost = $current_price;
             $shipping_cost_method_box = $current_price;
         } else {
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getShippingCostsCustomType'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getShippingCostsCustomType'] as $funcRef) {
                     $params['row3'] =& $row3;
                     $params['countries_id'] =& $countries_id;
                     $params['shipping_method'] =& $shipping_method;
                     $params['shipping_method_id'] =& $shipping_method_id;
                     $params['shipping_cost'] =& $shipping_cost;
                     $params['shipping_cost_method_box'] =& $shipping_cost_method_box;
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                 }
             } else {
                 $shipping_cost = $row3['price'];
                 $shipping_cost_method_box = $row3['price'];
             }
         }
         //
         // calculate total costs
         $subtotal = mslib_fe::countCartTotalPrice(1, 0, $countries_id);
         if (strstr($subtotal, ",")) {
             $subtotal = str_replace(',', '.', $subtotal);
         }
         //
         if (!empty($row3['override_shippingcosts'])) {
             $old_shipping_costs = $shipping_cost;
             $shipping_cost = $row3['override_shippingcosts'];
             // custom code to change the shipping costs based on cart amount
             if (strstr($shipping_cost, ",") || strstr($shipping_cost, ":")) {
                 $steps = explode(",", $shipping_cost);
                 $count = 0;
                 if (is_array($steps) && count($steps)) {
                     foreach ($steps as $step) {
                         // example: the value 200:15 means below 200 euro the shipping costs are 15 euro, above and equal 200 euro the shipping costs are 0 euro
                         // example setting: 0:6.95,50:0
                         $split = explode(":", $step);
                         if (is_numeric($split[0])) {
                             if ($subtotal > $split[0] and isset($split[1])) {
                                 $shipping_cost = $split[1];
                                 $shipping_cost_method_box = $split[1];
                                 continue;
                             } else {
                                 $shipping_cost = $old_shipping_costs;
                                 $shipping_cost_method_box = $old_shipping_costs;
                             }
                         }
                         $count++;
//.........这里部分代码省略.........
开发者ID:bvbmedia,项目名称:multishop,代码行数:101,代码来源:class.mslib_fe.php


注:本文中的mslib_fe::countCartTotalPrice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。