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


PHP mslib_fe::getCountryByName方法代码示例

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


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

示例1: array

if (is_array($cart['products']) and $count_products) {
    // load customer country
    // use for filtering the available payment on the customer country
    $address = $cart['user'];
    if (isset($this->post['country']) && !empty($this->post['country']) && $this->post['country'] != $address['country']) {
        $address['country'] = $this->post['country'];
    }
    if (!$address['country']) {
        $user_country = 0;
    } else {
        $iso_customer = mslib_fe::getCountryByName($address['country']);
        $user_country = $iso_customer['cn_iso_nr'];
    }
    $delivery_user_country = $user_country;
    if (isset($this->post['different_delivery_address']) && $this->post['different_delivery_address'] > 0 && !empty($this->post['delivery_country'])) {
        $iso_customer = mslib_fe::getCountryByName($this->post['delivery_country']);
        $delivery_user_country = $iso_customer['cn_iso_nr'];
    }
    $payment_methods_product = array();
    $shipping_methods_product = array();
    $payment_methods_group = array();
    $shipping_methods_group = array();
    $payment_methods_user = array();
    $shipping_methods_user = array();
    $payment_methods = array();
    $shipping_methods = array();
    $load_mappings_order = array();
    $load_mappings_order[] = 'products';
    $load_mappings_order[] = 'customers_groups';
    $load_mappings_order[] = 'customers';
    foreach ($load_mappings_order as $mapping) {
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:checkout.php

示例2: array

// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/get_method_costs.php']['getMethodCostsPreProc'])) {
    $params = array('cart' => &$cart);
    foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/get_method_costs.php']['getMethodCostsPreProc'] as $funcRef) {
        \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
    }
}
// hook oef
$tmp_countries = mslib_fe::getCountryByName($this->post['d_cc']);
$mslib_cart->setCountry($this->post['b_cc'], $tmp_countries['cn_iso_nr']);
$mslib_cart->setShippingMethod($this->post['tx_multishop_pi1']['sid']);
$mslib_cart->setPaymentMethod($this->post['tx_multishop_pi1']['pid']);
$cart = $mslib_cart->getCart();
// disable tax if the country is different and vat id is valid (NL & BE only)
if (isset($this->post['b_cc']) && !empty($this->post['b_cc']) && $this->post['tx_multishop_vat_id']) {
    $iso_customer = mslib_fe::getCountryByName($this->post['b_cc']);
    $iso_customer['country'] = $iso_customer['cn_short_en'];
    $vat_id = $this->post['tx_multishop_vat_id'];
}
$this->ms['MODULES']['DISABLE_VAT_RATE'] = 0;
if ($this->ms['MODULES']['DISABLE_VAT_FOR_FOREIGN_CUSTOMERS_WITH_COMPANY_VAT_ID'] and $vat_id) {
    if (strtolower($iso_customer['country']) != strtolower($this->tta_shop_info['country'])) {
        $this->ms['MODULES']['DISABLE_VAT_RATE'] = 1;
    }
}
$countries_id = $tmp_countries['cn_iso_nr'];
$payment_method = mslib_fe::getPaymentMethod($this->post['tx_multishop_pi1']['pid'], 'p.id', $countries_id, true);
if ($payment_method['handling_costs']) {
    if (!strstr($payment_method['handling_costs'], "%")) {
        $payment_method_costs = $payment_method['handling_costs'];
    } else {
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:get_method_costs.php

示例3: while

            $tmpcontent .= '<tr class="odd manual_add_new_product" style="display:none">';
            $tmpcontent .= '<td align="right">&nbsp;</td>
				<td align="right" valign="top">
					<input type="hidden" name="manual_product_name" id="product_name" value="">
					<input class="text" style="width:25px" type="text" name="manual_product_qty" id="manual_product_qty" value="1" tabindex="1" />
				</td>';
            $tmpcontent .= '<td align="left" valign="top" id="manual_add_product">
				<div id="manual_product_name_select2"><input class="product_name" type="hidden" name="manual_products_id" value="" style="width:400px" tabindex="2" /></div>';
            if ($this->ms['MODULES']['ENABLE_MANUAL_ORDER_CUSTOM_ORDER_PRODUCTS_NAME']) {
                $tmpcontent .= '<div id="custom_manual_product_name_wrapper" style="display:none"><label for="custom_manual_product_name">' . $this->pi_getLL('admin_custom_product_name') . ' :</label><input type="text" id="custom_manual_product_name" name="custom_manual_product_name" value="" disabled="disabled" width="300px" /></div>';
            }
            $tmpcontent .= '</td>';
            if ($this->ms['MODULES']['ADMIN_EDIT_ORDER_DISPLAY_ORDERS_PRODUCTS_STATUS'] > 0) {
                $tmpcontent .= '<td align="right">&nbsp;</td>';
            }
            $customer_country = mslib_fe::getCountryByName($orders['billing_country']);
            $sql_tax_sb = $GLOBALS['TYPO3_DB']->SELECTquery('t.tax_id, t.rate, t.name', 'tx_multishop_taxes t, tx_multishop_tax_rules tr, tx_multishop_tax_rule_groups trg', 't.tax_id=tr.tax_id and tr.rules_group_id=trg.rules_group_id and trg.status=1 and tr.cn_iso_nr=\'' . $customer_country['cn_iso_nr'] . '\'', '', '', '');
            $qry_tax_sb = $GLOBALS['TYPO3_DB']->sql_query($sql_tax_sb);
            $vat_sb = '<select name="manual_product_tax" id="product_tax">';
            $vat_sb .= '<option value="">' . $this->pi_getLL('admin_label_no_tax') . '</option>';
            while ($rs_tx_sb = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry_tax_sb)) {
                $sb_tax_rate = $rs_tx_sb['rate'] / 100;
                if ($current_product_tax == $sb_tax_rate) {
                    $vat_sb .= '<option value="' . $rs_tx_sb['tax_id'] . '" selected="selected">' . $rs_tx_sb['name'] . '</option>';
                } else {
                    $vat_sb .= '<option value="' . $rs_tx_sb['tax_id'] . '">' . $rs_tx_sb['name'] . '</option>';
                }
            }
            $vat_sb .= '</select>';
            if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
                $tmpcontent .= '<td align="right" class="cell_products_vat" valign="top">' . $vat_sb . '</td>';
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:zzzz_admin_edit_order.php

示例4: json_encode

     echo json_encode($return_data);
     exit;
     break;
 case 'get_shoppingcart_shippingcost_overview':
     if ($this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT'] == '1') {
         $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] = 1;
     }
     $return_data = array();
     if ($this->tta_user_info['default']['country']) {
         $iso_customer = mslib_fe::getCountryByName($this->tta_user_info['default']['country']);
     } else {
         $iso_customer = $this->tta_shop_info;
     }
     if (!$iso_customer['cn_iso_nr']) {
         // fall back (had issue with admin notification)
         $iso_customer = mslib_fe::getCountryByName($this->tta_shop_info['country']);
     }
     $delivery_country_id = $this->post['tx_multishop_pi1']['country_id'];
     $shipping_method_id = $this->post['tx_multishop_pi1']['shipping_method'];
     $shipping_cost_data = mslib_fe::getShoppingcartShippingCostsOverview($iso_customer['cn_iso_nr'], $delivery_country_id, $shipping_method_id);
     $count_cart_incl_vat = 0;
     if ($this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT']) {
         $count_cart_incl_vat = 1;
     }
     //
     $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) {
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:core.php

示例5: foreach

        $content .= '
		</ul>
		</div>
		';
    }
    if (count($shipping_methods)) {
        $content .= '
		<div id="multishopShippingMethodWrapper">
		<div class="main-heading"><h2>' . $this->pi_getLL('choose_shipping_method') . '</h2></div>
		<ul id="multishopShippingMethod" class="row">';
        $count = 0;
        $delivery_country = $cart['user']['country'];
        if (isset($cart['user']['different_delivery_address']) && !empty($cart['user']['different_delivery_address']) && isset($cart['user']['delivery_country']) && !empty($cart['user']['delivery_country'])) {
            $delivery_country = $cart['user']['delivery_country'];
        }
        $tmp_countries = mslib_fe::getCountryByName($delivery_country);
        $countries_id = $tmp_countries['cn_iso_nr'];
        foreach ($shipping_methods as $code => $item) {
            $shipping_method = mslib_fe::getShippingMethod($item['id'], 's.id', $countries_id);
            // custom hook that can be controlled by third-party plugin
            $shipping_method_description = '';
            if (!empty($item['description'])) {
                $shipping_method_description = '<div class="description">' . $item['description'] . '</div>';
            }
            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/front_pages/includes/checkout/multistep/checkout_shipping_payment_method']['checkoutMultistepShippingMethodSelectionHook'])) {
                $params = array('shipping_method' => &$shipping_method, 'item' => &$item, 'shipping_method_description' => &$shipping_method_description);
                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/front_pages/includes/checkout/multistep/checkout_shipping_payment_method']['checkoutMultistepShippingMethodSelectionHook'] as $funcRef) {
                    \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                }
            }
            $count++;
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:checkout_shipping_payment_method.php

示例6: 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

示例7: createOrder

 function createOrder($address)
 {
     if (is_numeric($address['uid'])) {
         $customer_id = $address['uid'];
     } else {
         if (!$address['email']) {
             return false;
         }
         $tmp_user = mslib_fe::getUser($address['email'], 'email');
         if ($tmp_user['uid']) {
             $customer_id = $tmp_user['uid'];
         }
     }
     if (!$customer_id) {
         // add new account
         $insertArray = array();
         $insertArray['page_uid'] = $this->shop_pid;
         $insertArray['company'] = $address['company'];
         $insertArray['name'] = $address['first_name'] . ' ' . $address['middle_name'] . ' ' . $address['last_name'];
         $insertArray['name'] = preg_replace('/\\s+/', ' ', $insertArray['name']);
         $insertArray['first_name'] = $address['first_name'];
         $insertArray['last_name'] = $address['last_name'];
         $insertArray['username'] = $address['email'];
         $insertArray['email'] = $address['email'];
         $insertArray['street_name'] = $address['street_name'];
         if (!$insertArray['street_name']) {
             $insertArray['street_name'] = $address['address'];
         }
         $insertArray['address_number'] = $address['address_number'];
         $insertArray['address_ext'] = $address['address_ext'];
         if ($address['address']) {
             $insertArray['address'] = $address['address'];
         } else {
             $insertArray['address'] = $insertArray['street_name'] . ' ' . $insertArray['address_number'] . $insertArray['address_ext'];
             $insertArray['address'] = preg_replace('/\\s+/', ' ', $insertArray['address']);
         }
         $insertArray['zip'] = $address['zip'];
         $insertArray['telephone'] = $address['telephone'];
         $insertArray['city'] = $address['city'];
         $insertArray['country'] = $address['country'];
         $insertArray['usergroup'] = $this->conf['fe_customer_usergroup'];
         $insertArray['pid'] = $this->conf['fe_customer_pid'];
         $insertArray['tstamp'] = time();
         $insertArray['tx_multishop_newsletter'] = $address['tx_multishop_newsletter'];
         $insertArray['password'] = mslib_befe::getHashedPassword(mslib_befe::generateRandomPassword(10, $insertArray['username']));
         $query = $GLOBALS['TYPO3_DB']->INSERTquery('fe_users', $insertArray);
         $res = $GLOBALS['TYPO3_DB']->sql_query($query);
         if ($res) {
             $customer_id = $GLOBALS['TYPO3_DB']->sql_insert_id();
         }
     }
     if ($customer_id) {
         if ($this->ms['MODULES']['DISABLE_VAT_FOR_FOREIGN_CUSTOMERS_WITH_COMPANY_VAT_ID']) {
             // if store country is different than customer country change VAT rate to zero
             if ($address['country'] && $address['tx_multishop_vat_id']) {
                 $iso_customer = mslib_fe::getCountryByName($address['country']);
                 if ($iso_customer['cn_iso_nr'] != $this->ms['MODULES']['COUNTRY_ISO_NR']) {
                     $this->ms['MODULES']['DISABLE_VAT_RATE'] = 1;
                 }
             }
             // if store country is different than customer country change VAT rate to zero eof
         }
         // now add the order
         $insertArray = array();
         $insertArray['customer_id'] = $customer_id;
         $insertArray['page_uid'] = $this->shop_pid;
         $insertArray['language_id'] = 0;
         if (is_numeric($address['language_id'])) {
             $insertArray['language_id'] = $address['language_id'];
         }
         $insertArray['status'] = '';
         if (isset($address['status']) && $address['status'] > 0) {
             // Set order status
             $insertArray['status'] = $address['status'];
         } else {
             // get default orders status
             $status = mslib_fe::getDefaultOrdersStatus($this->sys_language_uid);
             if (is_array($status) && isset($status['id']) && $status['id'] > 0) {
                 $insertArray['status'] = $status['id'];
             }
         }
         $insertArray['customer_comments'] = $this->post['customer_comments'];
         $insertArray['billing_company'] = $address['company'];
         $insertArray['billing_first_name'] = $address['first_name'];
         $insertArray['billing_middle_name'] = $address['middle_name'];
         $insertArray['billing_last_name'] = $address['last_name'];
         $insertArray['billing_name'] = preg_replace('/ +/', ' ', $address['first_name'] . ' ' . $address['middle_name'] . ' ' . $address['last_name']);
         $insertArray['billing_email'] = $address['email'];
         $insertArray['billing_gender'] = $address['gender'];
         $insertArray['billing_birthday'] = $address['birthday'];
         if (!$address['street_name']) {
             $address['street_name'] = $address['address'];
         }
         $insertArray['billing_building'] = $address['building'];
         $insertArray['billing_street_name'] = $address['street_name'];
         $insertArray['billing_address_number'] = $address['address_number'];
         $insertArray['billing_address_ext'] = $address['address_ext'];
         $insertArray['billing_address'] = $address['street_name'] . ' ' . $address['address_number'] . $address['address_ext'];
         $insertArray['billing_address'] = preg_replace('/\\s+/', ' ', $insertArray['billing_address']);
         $insertArray['billing_room'] = '';
//.........这里部分代码省略.........
开发者ID:bvbmedia,项目名称:multishop,代码行数:101,代码来源:class.tx_mslib_order.php


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