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


PHP mslib_fe::getProductMappedMethods方法代码示例

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


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

示例1: array

$load_mappings_order = array();
$load_mappings_order[] = 'products';
$load_mappings_order[] = 'customers_groups';
$load_mappings_order[] = 'customers';
foreach ($load_mappings_order as $mapping) {
    switch ($mapping) {
        case 'products':
            if ($this->ms['MODULES']['PRODUCT_EDIT_METHOD_FILTER']) {
                $pids = array();
                foreach ($cart['products'] as $key => $array) {
                    if (is_numeric($array['products_id'])) {
                        $pids[] = $array['products_id'];
                    }
                }
                if (count($pids)) {
                    $mapped_shipping_methods_product = mslib_fe::getProductMappedMethods($pids, 'shipping', $tmp_countries['cn_iso_nr']);
                }
            }
            break;
        case 'customers_groups':
            if (mslib_fe::loggedin() && $this->ms['MODULES']['GROUP_EDIT_METHOD_FILTER']) {
                $user_groups = array();
                $user_groups = explode(',', $GLOBALS['TSFE']->fe_user->user['usergroup']);
                if (count($user_groups)) {
                    $mapped_shipping_methods_group = mslib_fe::getCustomerGroupMappedMethods($user_groups, 'shipping', $tmp_countries['cn_iso_nr']);
                }
            }
            break;
        case 'customers':
            if (mslib_fe::loggedin() && $this->ms['MODULES']['CUSTOMER_EDIT_METHOD_FILTER']) {
                $user_id = array();
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:get_method_costs.php

示例2: foreach

 $load_mappings_order[] = 'customers';
 foreach ($load_mappings_order as $mapping) {
     switch ($mapping) {
         case 'products':
             if ($this->ms['MODULES']['PRODUCT_EDIT_METHOD_FILTER']) {
                 $payment_methods = array();
                 $shipping_methods = array();
                 $pids = array();
                 foreach ($cart['products'] as $key => $array) {
                     if (is_numeric($array['products_id'])) {
                         $pids[] = $array['products_id'];
                     }
                 }
                 if (count($pids)) {
                     $payment_methods_product = mslib_fe::getProductMappedMethods($pids, 'payment', $user_country);
                     $shipping_methods_product = mslib_fe::getProductMappedMethods($pids, 'shipping');
                 }
             }
             break;
         case 'customers_groups':
             if ($this->ms['MODULES']['GROUP_EDIT_METHOD_FILTER']) {
                 $payment_methods = array();
                 $shipping_methods = array();
                 $tmp_user_groups = explode(',', $GLOBALS['TSFE']->fe_user->user['usergroup']);
                 $user_groups = array();
                 foreach ($tmp_user_groups as $tmp_user_group) {
                     if ($tmp_user_group > 0) {
                         $user_groups[] = $tmp_user_group;
                     }
                 }
                 if (count($user_groups)) {
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:checkout.php

示例3: getProductShippingCostsOverview

 public function getProductShippingCostsOverview($countries_id, $products_id, $products_quantity = 1)
 {
     if (!is_numeric($countries_id)) {
         return false;
     }
     if (!is_numeric($products_id)) {
         return false;
     }
     $product_data = mslib_fe::getProduct($products_id);
     if (!is_numeric($products_quantity)) {
         $products_quantity = 1;
         if ($product_data['minimum_quantity'] > 0) {
             $products_quantity = $product_data['minimum_quantity'];
         }
     }
     $product_mappings = mslib_fe::getProductMappedMethods(array($products_id), 'shipping', $countries_id);
     $shipping_method_data = mslib_fe::loadShippingMethods(0, $countries_id, true, true);
     if (!count($product_mappings)) {
         $product_mappings = $shipping_method_data;
     }
     $shipping_methods = array();
     foreach ($shipping_method_data as $load_shipping_method) {
         $shipping_method_id = $load_shipping_method['id'];
         $str3 = $GLOBALS['TYPO3_DB']->SELECTquery('sm.shipping_costs_type, sm.handling_costs, c.override_shippingcosts, c.price, c.zone_id', 'tx_multishop_shipping_methods sm, tx_multishop_shipping_methods_costs c, tx_multishop_countries_to_zones c2z', 'c.shipping_method_id=\'' . $shipping_method_id . '\' and (sm.page_uid=0 or sm.page_uid=\'' . $this->shop_pid . '\') and sm.id=c.shipping_method_id and c.zone_id=c2z.zone_id 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);
             if (isset($product_mappings[$shipping_method['code']])) {
                 if ($row3['shipping_costs_type'] == 'weight') {
                     $total_weight = $product_data['products_weight'] * $products_quantity;
                     $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;
                 } elseif ($row3['shipping_costs_type'] == 'quantity') {
                     $total_quantity = $products_quantity;
                     $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;
                 } else {
                     $shipping_cost = $row3['price'];
                 }
                 $subtotal = $product_data['final_price'];
                 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];
                                         continue;
                                     } else {
                                         $shipping_cost = $old_shipping_costs;
                                     }
                                 }
                                 $count++;
                             }
                         }
                     }
                 }
                 // custom code to change the shipping costs based on cart amount
                 if (strstr($shipping_cost, ",")) {
                     $steps = explode(",", $shipping_cost);
                     // calculate total costs
                     $count = 0;
                     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 ($count == 0) {
                                 if (isset($split[1])) {
//.........这里部分代码省略.........
开发者ID:bvbmedia,项目名称:multishop,代码行数:101,代码来源:class.mslib_fe.php

示例4: array

     break;
 case 'get_shoppingcart_shippingmethod_overview':
     $return_data = array();
     $country_cn_iso_nr = $this->post['tx_multishop_pi1']['country_id'];
     //
     //$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();
     $products = $cart['products'];
     $pids = array();
     foreach ($products as $product) {
         $pids[] = $product['products_id'];
     }
     $product_mappings = mslib_fe::getProductMappedMethods($pids, 'shipping', $country_cn_iso_nr);
     //
     $shipping_methods = mslib_fe::loadShippingMethods(0, $country_cn_iso_nr, true, true);
     if (!count($product_mappings)) {
         $product_mappings = $shipping_methods;
     }
     $return_data['shipping_methods'] = array();
     foreach ($shipping_methods as $shipping_method) {
         if (isset($product_mappings[$shipping_method['code']])) {
             $return_data['shipping_methods'][] = $shipping_method;
         }
     }
     echo json_encode($return_data);
     exit;
     break;
 case 'get_shoppingcart_shippingcost_overview':
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:core.php

示例5: array

$load_mappings_order = array();
$load_mappings_order[] = 'products';
$load_mappings_order[] = 'customers_groups';
$load_mappings_order[] = 'customers';
foreach ($load_mappings_order as $mapping) {
    switch ($mapping) {
        case 'products':
            if ($this->ms['MODULES']['PRODUCT_EDIT_METHOD_FILTER']) {
                $pids = array();
                foreach ($cart['products'] as $key => $array) {
                    if (is_numeric($array['products_id'])) {
                        $pids[] = $array['products_id'];
                    }
                }
                if (count($pids)) {
                    $payment_methods_product = mslib_fe::getProductMappedMethods($pids, 'payment', $countries_id);
                }
            }
            break;
        case 'customers_groups':
            if (mslib_fe::loggedin() && $this->ms['MODULES']['GROUP_EDIT_METHOD_FILTER']) {
                $user_groups = array();
                $user_groups = explode(',', $GLOBALS['TSFE']->fe_user->user['usergroup']);
                if (count($user_groups)) {
                    $payment_methods_group = mslib_fe::getCustomerGroupMappedMethods($user_groups, 'payment', $countries_id);
                }
            }
            break;
        case 'customers':
            if (mslib_fe::loggedin() && $this->ms['MODULES']['CUSTOMER_EDIT_METHOD_FILTER']) {
                $user_id = array();
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:get_country_payment_methods.php


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