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


PHP shopFunctions::getCountryIDByName方法代码示例

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


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

示例1: plgVmOnSelectCheckPayment

 /**
  * This event is fired after the payment method has been selected. It can be used to store
  * additional payment info in the cart.
  * @author Valérie isaksen
  *
  * @param VirtueMartCart $cart: the actual cart
  * @return null if the payment was not selected, true if the data is valid, error message if the data is not vlaid
  *
  */
 public function plgVmOnSelectCheckPayment(VirtueMartCart $cart)
 {
     if (!$this->selectedThisByMethodId($cart->virtuemart_paymentmethod_id)) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!($method = $this->getVmPluginMethod($cart->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!class_exists('KlarnaAddr')) {
         require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'api' . DS . 'klarnaaddr.php';
     }
     $session = JFactory::getSession();
     $sessionKlarna = new stdClass();
     //$post = JRequest::get('post');
     $klarnaData_paymentmethod = JRequest::getVar('klarna_paymentmethod', '');
     if ($klarnaData_paymentmethod == 'klarna_invoice') {
         $klarnaData_payment = "klarna_invoice";
         $sessionKlarna->klarna_option = 'invoice';
     } elseif ($klarnaData_paymentmethod == 'klarna_partPayment') {
         $klarnaData_payment = "klarna_partpay";
         $sessionKlarna->klarna_option = 'part';
     } elseif ($klarnaData_paymentmethod == 'klarna_speccamp') {
         $klarnaData_payment = "klarna_speccamp";
         $sessionKlarna->klarna_option = 'spec';
     } else {
         return NULL;
     }
     // Store payment_method_id so we can activate the
     // right payment in case something goes wrong.
     $sessionKlarna->virtuemart_payment_method_id = $cart->virtuemart_paymentmethod_id;
     $sessionKlarna->klarna_paymentmethod = $klarnaData_paymentmethod;
     $this->_getCartAddressCountryCode($cart, $country3, $countryId, 'country_3_code');
     // $country2=  strtolower($country2);
     if (empty($country3)) {
         $country3 = "SWE";
         $countryId = ShopFunctions::getCountryIDByName($country3);
     }
     $cData = KlarnaHandler::countryData($method, strtoupper($country3));
     $klarnaData = KlarnaHandler::getDataFromEditPayment();
     $klarnaData['country'] = $cData['country_code'];
     //$country = $cData['country_code']; //KlarnaHandler::convertCountry($method, $country2);
     //$lang = $cData['language_code']; //KlarnaHandler::getLanguageForCountry($method, $country);
     // Get the correct data
     //Removes spaces, tabs, and other delimiters.
     // If it is a swedish customer we use the information from getAddress
     if (strtolower($cData['country_code']) == "se") {
         if (empty($klarnaData['socialNumber'])) {
             VmInfo('VMPAYMENT_KLARNA_MUST_VALID_PNO');
             return false;
         }
         $swedish_addresses = klarnaHandler::getAddresses($klarnaData['socialNumber'], $cData, $method);
         if (empty($swedish_addresses)) {
             VmInfo('VMPAYMENT_KLARNA_NO_GETADDRESS');
             return false;
         }
         //This example only works for GA_GIVEN.
         foreach ($swedish_addresses as $address) {
             if ($address->isCompany) {
                 $klarnaData['company_name'] = $address->getCompanyName();
             } else {
                 $klarnaData['first_name'] = $address->getFirstName();
                 $klarnaData['last_name'] = $address->getLastName();
             }
             $klarnaData['street'] = $address->getStreet();
             $klarnaData['zip'] = $address->getZipCode();
             $klarnaData['city'] = $address->getCity();
             $klarnaData['country'] = $address->getCountryCode();
             $countryId = $klarnaData['virtuemart_country_id'] = shopFunctions::getCountryIDByName($klarnaData['country']);
         }
         foreach ($klarnaData as $key => $value) {
             $klarnaData[$key] = mb_convert_encoding($klarnaData[$key], 'UTF-8', 'ISO-8859-1');
         }
     } elseif (!KlarnaHandler::checkDataFromEditPayment($klarnaData)) {
         //VmInfo('VMPAYMENT_KLARNA_MISSING_DATA');
         //return false;
     }
     $st = $this->getCartAddress($cart, $address_type, true);
     if ($address_type == 'BT') {
         $prefix = '';
     } else {
         $prefix = 'shipto_';
     }
     // Update the Shipping Address to what is specified in the register.
     $update_data = array($prefix . 'address_type_name' => 'Klarna', $prefix . 'company' => $klarnaData['company_name'], $prefix . 'first_name' => $klarnaData['first_name'], $prefix . 'middle_name' => $st['middle_name'], $prefix . 'last_name' => $klarnaData['last_name'], $prefix . 'address_1' => $klarnaData['street'], $prefix . 'address_2' => $klarnaData['house_ext'], $prefix . 'house_no' => $klarnaData['house_no'], $prefix . 'zip' => html_entity_decode($klarnaData['zip']), $prefix . 'city' => $klarnaData['city'], $prefix . 'virtuemart_country_id' => $countryId, $prefix . 'state' => '', $prefix . 'phone_1' => $klarnaData['phone'], $prefix . 'phone_2' => $st['phone_2'], $prefix . 'fax' => $st['fax'], $prefix . 'birthday' => empty($klarnaData['birthday']) ? $st['birthday'] : $klarnaData['birthday'], $prefix . 'social_number' => empty($klarnaData['pno']) ? $klarnaData['socialNumber'] : $klarnaData['pno'], 'address_type' => $address_type);
     if ($address_type == 'BT') {
         $update_data['email'] = $klarnaData['email'];
     }
     // save address in cart if different
     // 	if (false) {
//.........这里部分代码省略.........
开发者ID:joselapria,项目名称:virtuemart,代码行数:101,代码来源:klarna.php

示例2: updateAddressInCart

 function updateAddressInCart($cart, $klarna_address, $address_type)
 {
     if ($address_type == 'BT') {
         $prefix = '';
         $vmAddress = $cart->BT;
     } else {
         $prefix = 'shipto_';
         $vmAddress = $cart->ST;
     }
     $this->debugLog($klarna_address, 'updateAddressInCart', 'debug');
     // Update the Shipping Address to what is specified in the register.
     $update_data = array($prefix . 'address_type_name' => 'klarnacheckout', $prefix . 'company' => isset($klarna_address['company_name']) ? $klarna_address['company_name'] : '', $prefix . 'first_name' => $klarna_address['given_name'], $prefix . 'last_name' => $klarna_address['family_name'], $prefix . 'address_1' => $klarna_address['street_address'], $prefix . 'address_2' => isset($klarna_address['street_address2']) ? $klarna_address['street_address2'] : '', $prefix . 'zip' => $klarna_address['postal_code'], $prefix . 'city' => $klarna_address['city'], $prefix . 'virtuemart_country_id' => shopFunctions::getCountryIDByName($klarna_address['country']), $prefix . 'state' => '', $prefix . 'phone_1' => $klarna_address['phone'], 'address_type' => $address_type);
     if ($address_type == 'BT') {
         $update_data['email'] = strtolower($klarna_address['email']);
     }
     $update_data['tos'] = 1;
     if (!empty($st)) {
         $update_data = array_merge($vmAddress, $update_data);
     }
     $cart->saveAddressInCart($update_data, $update_data['address_type'], TRUE, $prefix);
 }
开发者ID:virtuemart-fr,项目名称:virtuemart-fr,代码行数:21,代码来源:klarnacheckout.php

示例3: getUserInfoFromAmazon

	private function getUserInfoFromAmazon ($amazonAddress, $prefix = '', $all = true, $getEmail = false) {

		if ($amazonAddress->isSetName()) {
			$userInfoData[$prefix . 'last_name'] = $amazonAddress->getName();
			$userInfoData[$prefix . 'first_name'] = '';
		}

		if ($getEmail AND $amazonAddress->isSetEmail()) {
			$userInfoData['email'] = $amazonAddress->getEmail();
		}
		if ($amazonAddress->isSetPhone()) {
			$userInfoData['phone_1'] = $amazonAddress->getPhone();

		}
		if ($all) {
			if ($amazonAddress->isSetAddressLine1()) {
				$userInfoData[$prefix . 'address_1'] = $amazonAddress->getAddressLine1();
				if ($amazonAddress->isSetAddressLine2()) {
					$userInfoData[$prefix . 'address_2'] = $amazonAddress->getAddressLine2();
				}
				if ($amazonAddress->isSetAddressLine3()) {
					$userInfoData[$prefix . 'address_2'] .= ", " . $amazonAddress->getAddressLine3();
				}
			} else {
				if ($amazonAddress->isSetAddressLine2()) {
					$userInfoData[$prefix . 'address_1'] = $amazonAddress->getAddressLine2();
				}
				if ($amazonAddress->isSetAddressLine3()) {
					$userInfoData[$prefix . 'address_2'] = $amazonAddress->getAddressLine3();
				}
			}

			if ($amazonAddress->isSetCity()) {
				$userInfoData[$prefix . 'city'] = $amazonAddress->getCity();
			}
			if ($amazonAddress->isSetCounty()) {
				//$userInfoData['county'] = $amazonAddress->getCounty();
			}
			if ($amazonAddress->isSetDistrict()) {
				//$userInfoData['district'] = $amazonAddress->GetDistrict();
			}
			if ($amazonAddress->isSetStateOrRegion()) {
				$stateId = shopFunctions::getStateIDByName($amazonAddress->GetStateOrRegion());
				if ($stateId) {
					$userInfoData[$prefix . 'virtuemart_state_id'] = $stateId;
				} else {
					$userInfoData[$prefix . 'virtuemart_state_id'] = 0;
				}
			}
			if ($amazonAddress->isSetPostalCode()) {
				$userInfoData[$prefix . 'zip'] = $amazonAddress->GetPostalCode();
			}
			if ($amazonAddress->isSetCountryCode()) {
				$userInfoData[$prefix . 'virtuemart_country_id'] = shopFunctions::getCountryIDByName($amazonAddress->GetCountryCode());
			}
		}


		return $userInfoData;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:60,代码来源:amazon.php


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