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


PHP shopFunctions::getCountryByID方法代码示例

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


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

示例1: displayKlarnaLogos

 function displayKlarnaLogos($method, $virtuemart_country_id, $shipTo, $total)
 {
     $session = JFactory::getSession();
     $sessionKlarna = $session->get('Klarna', 0, 'vm');
     if (empty($sessionKlarna)) {
         return '';
     }
     $sessionKlarnaData = unserialize($sessionKlarna);
     $address['virtuemart_country_id'] = $virtuemart_country_id;
     $cData = KlarnaHandler::getcData($method, $address);
     $country2 = strtolower(shopFunctions::getCountryByID($virtuemart_country_id, 'country_2_code'));
     switch ($sessionKlarnaData->klarna_option) {
         case 'invoice':
             $image = '/klarna_invoice_' . $country2 . '.png';
             $klarna_invoice_fee = KlarnaHandler::getInvoiceFeeInclTax($method, $cData['country_code_3']);
             $currency = CurrencyDisplay::getInstance();
             $display_fee = $currency->priceDisplay($klarna_invoice_fee);
             $text = JText::sprintf('VMPAYMENT_KLARNA_INVOICE_TITLE_NO_PRICE', $display_fee);
             break;
         case 'partpayment':
         case 'part':
             $image = '/klarna_part_' . $country2 . '.png';
             $address['virtuemart_country_id'] = $virtuemart_country_id;
             $pclasses = KlarnaHandler::getPClasses(NULL, $country2, KlarnaHandler::getKlarnaMode($method), $cData);
             if (!class_exists('Klarna_payments')) {
                 require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarna_payments.php';
             }
             if (!class_exists('KlarnaVm2API')) {
                 require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarna_vm2api.php';
             }
             $payments = new klarna_payments($cData, $shipTo);
             //vmdebug('displaylogos',$cart_prices);
             $totalInPaymentCurrency = KlarnaHandler::convertPrice($total, $cData['currency_code']);
             $text = $payments->displayPclass($sessionKlarnaData->KLARNA_DATA['pclass'], $totalInPaymentCurrency);
             // .' '.$total;
             break;
         case 'speccamp':
             $image = 'klarna_logo.png';
             $text = JText::_('VMPAYMENT_KLARNA_SPEC_TITLE');
             break;
         default:
             $image = '';
             $text = '';
             break;
     }
     $html = $this->renderByLayout('payment_cart', array('logo' => $image, 'description' => $text));
     return $html;
 }
开发者ID:joselapria,项目名称:virtuemart,代码行数:48,代码来源:klarna.php

示例2: getUserFieldsFilled

 /**
  * Return an array with userFields in several formats.
  *
  * @access public
  * @param $_selection An array, as returned by getuserFields(), with fields that should be returned.
  * @param $_userData Array with userdata holding the values for the fields
  * @param $_prefix string Optional prefix for the formtag name attribute
  * @author Oscar van Eijk
  * @return array List with all userfield data in the format:
  * array(
  *    'fields' => array(   // All fields
  *                   <fieldname> => array(
  *                                     'name' =>       // Name of the field
  *                                     'value' =>      // Existing value for the current user, or the default
  *                                     'title' =>      // Title used for label and such
  *                                     'type' =>       // Field type as specified in the userfields table
  *                                     'hidden' =>     // True/False
  *                                     'required' =>   // True/False. If True, the formcode also has the class "required" for the Joomla formvalidator
  *                                     'formcode' =>   // Full HTML tag
  *                                  )
  *                   [...]
  *                )
  *    'functions' => array() // Optional javascript functions without <script> tags.
  *                           // Possible usage: if (count($ar('functions')>0) echo '<script ...>'.join("\n", $ar('functions')).'</script>;
  *    'scripts'   => array(  // Array with scriptsources for use with JHTML::script();
  *                      <name> => <path>
  *                      [...]
  *                   )
  *    'links'     => array(  // Array with stylesheets for use with JHTML::stylesheet();
  *                      <name> => <path>
  *                      [...]
  *                   )
  * )
  * @example This example illustrates the use of this function. For additional examples, see the Order view
  * and the User view in the administrator section.
  * <pre>
  *   // In the controller, make sure this model is loaded.
  *   // In view.html.php, make the following calls:
  *   $_usrDetails = getUserDetailsFromSomeModel(); // retrieve an user_info record, eg from the usermodel or ordermodel
  *   $_usrFieldList = $userFieldsModel->getUserFields(
  *                    'registration'
  *                  , array() // Default switches
  *                  , array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type') // Skips
  *    );
  *   $usrFieldValues = $userFieldsModel->getUserFieldsFilled(
  *                      $_usrFieldList
  *                     ,$_usrDetails
  *   );
  *   $this->assignRef('userfields', $userfields);
  *   // In the template, use code below to display the data. For an extended example using
  *   // delimiters, JavaScripts and StyleSheets, see the edit_shopper.php in the user view
  *   <table class="admintable" width="100%">
  *     <thead>
  *       <tr>
  *         <td class="key" style="text-align: center;"  colspan="2">
  *            <?php echo JText::_('COM_VIRTUEMART_TABLE_HEADER') ?>
  *         </td>
  *       </tr>
  *     </thead>
  *      <?php
  *        foreach ($this->shipmentfields['fields'] as $_field ) {
  *          echo '  <tr>'."\n";
  *          echo '    <td class="key">'."\n";
  *          echo '      '.$_field['title']."\n";
  *          echo '    </td>'."\n";
  *          echo '    <td>'."\n";
  *
  *          echo '      '.$_field['value']."\n";    // Display only
  *       Or:
  *          echo '      '.$_field['formcode']."\n"; // Input form
  *
  *          echo '    </td>'."\n";
  *          echo '  </tr>'."\n";
  *        }
  *      ?>
  *    </table>
  * </pre>
  */
 public function getUserFieldsFilled($_selection, $_userData = null, $_prefix = '')
 {
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $_return = array('fields' => array(), 'functions' => array(), 'scripts' => array(), 'links' => array());
     // 		vmdebug('my user data in getUserFieldsFilled',$_selection,$_userData);
     $_userData = (array) $_userData;
     if (is_array($_selection)) {
         foreach ($_selection as $_fld) {
             $_return['fields'][$_fld->name] = array('name' => $_prefix . $_fld->name, 'value' => $_userData == null || !array_key_exists($_fld->name, $_userData) ? $_fld->default : @$_userData[$_fld->name], 'title' => JText::_($_fld->title), 'type' => $_fld->type, 'required' => $_fld->required, 'hidden' => false, 'formcode' => '');
             // 				vmdebug ('getUserFieldsFilled',$_fld->name);
             // 			if($_fld->name==='email') vmdebug('user data email getuserfieldbyuser',$_userData);
             // First, see if there are predefined fields by checking the name
             switch ($_fld->name) {
                 // 				case 'email':
                 // 					$_return['fields'][$_fld->name]['formcode'] = $_userData->email;
                 // 					break;
                 case 'virtuemart_country_id':
                     $_return['fields'][$_fld->name]['formcode'] = ShopFunctions::renderCountryList($_return['fields'][$_fld->name]['value'], false, array(), $_prefix, $_fld->required);
                     // Translate the value from ID to name
                     $_return['fields'][$_fld->name]['value'] = shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']);
//.........这里部分代码省略.........
开发者ID:joselapria,项目名称:virtuemart,代码行数:101,代码来源:userfields.php

示例3: renderKlarnaPluginName

	/**
	 * @param $method
	 * @param $virtuemart_country_id
	 * @param $shipTo
	 * @param $total
	 * @return string
	 */
	protected function renderKlarnaPluginName ($method, $virtuemart_country_id, $shipTo, $total, $cartPricesCurrency) {

		$session = JFactory::getSession ();
		$sessionKlarna = $session->get ('Klarna', 0, 'vm');
		if (empty($sessionKlarna)) {
			return '';
		}
		$sessionKlarnaData = unserialize ($sessionKlarna);
		$address['virtuemart_country_id'] = $virtuemart_country_id;
		$cData = KlarnaHandler::getcData ($method, $address);
		$country2 = strtolower (shopFunctions::getCountryByID ($virtuemart_country_id, 'country_2_code'));
		$text = "";
		if (isset($sessionKlarnaData->klarna_option)) {
			switch ($sessionKlarnaData->klarna_option) {
				case 'invoice':
					$sType='invoice';
					$image = '/klarna_invoice_' . $country2 . '.png';
					//$logo = VMKLARNAPLUGINWEBASSETS . '/images/' . 'logo/klarna_' . $sType . '_' . $code2 . '.png';
					$image ="https://cdn.klarna.com/public/images/".strtoupper($country2)."/badges/v1/". $sType ."/".$country2."_". $sType ."_badge_std_blue.png?height=55&eid=".$cData['eid'];
					$display_invoice_fee = NULL;
					$invoice_fee = 0;
					KlarnaHandler::getInvoiceFeeInclTax ($method, $cData['country_code_3'], $cartPricesCurrency, $cData['virtuemart_currency_id'], $display_invoice_fee, $invoice_fee);
					$text = JText::sprintf ('VMPAYMENT_KLARNA_INVOICE_TITLE_NO_PRICE', $display_invoice_fee);
					break;
				case 'partpayment':
				case 'part':
					$sType='account';
					//$image = '/klarna_part_' . $country2 . '.png';
					$image ="https://cdn.klarna.com/public/images/".strtoupper($country2)."/badges/v1/". $sType ."/".$country2."_". $sType ."_badge_std_blue.png?height=55&eid=".$cData['eid'];

					$address['virtuemart_country_id'] = $virtuemart_country_id;
					//$pclasses                         = KlarnaHandler::getPClasses(NULL,   KlarnaHandler::getKlarnaMode($method), $cData);
					if (!class_exists ('Klarna_payments')) {
						require (JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarna_payments.php');
					}

					$payments = new klarna_payments($cData, $shipTo);
					//vmdebug('displaylogos',$cart_prices);
					$totalInPaymentCurrency = KlarnaHandler::convertPrice ($total, $cData['vendor_currency'], $cData['virtuemart_currency_id']);
					vmdebug ('totalInPaymentCurrency', $totalInPaymentCurrency);
					if (isset($sessionKlarnaData->KLARNA_DATA)) {
						$text = $payments->displayPclass ($sessionKlarnaData->KLARNA_DATA['pclass'], $totalInPaymentCurrency); // .' '.$total;
					}
					break;
				case 'speccamp':
					$image = 'klarna_logo.png';
					$text = JText::_ ('VMPAYMENT_KLARNA_SPEC_TITLE');
					break;
				default:
					$image = '';
					$text = '';
					break;
			}

			$plugin_name = $this->_psType . '_name';
			$plugin_desc = $this->_psType . '_desc';
			$payment_description = '';
			if (!empty($method->$plugin_desc)) {
				$payment_description = $method->$plugin_desc;
			}
			$payment_name = $method->$plugin_name;

			$html = $this->renderByLayout ('payment_cart', array(
				'logo'                => $image,
				'text'                => $text,
				'payment_description' => $payment_description,
				'payment_name'        => $payment_name
			));
			return $html;
		}
	}
开发者ID:sergy444,项目名称:joomla,代码行数:78,代码来源:klarna.php

示例4: fetchAllPClasses

 /**
  * @static
  * @param $method
  * @return array
  */
 public static function fetchAllPClasses($method)
 {
     $message = '';
     $success = '';
     $results = array();
     $countries = self::getKlarnaCountries();
     $pc_type = KlarnaHandler::getKlarna_pc_type();
     if (empty($pc_type)) {
         return FALSE;
     } else {
         // delete the file directly
         if (file_exists($pc_type)) {
             unlink($pc_type);
         }
     }
     foreach ($countries as $country) {
         $active_country = "klarna_active_" . $country;
         if ($method->{$active_country}) {
             // country is CODE 3==> converting to 2 letter country
             //$country = self::convertCountryCode($method, $country);
             $lang = self::getLanguageForCountry($method, $country);
             $flagImg = JURI::root(TRUE) . '/administrator/components/com_virtuemart/assets/images/flag/' . strtolower($lang) . '.png';
             $flag = "<img src='" . $flagImg . "' />";
             try {
                 $settings = self::getCountryData($method, $country);
                 $klarna = new Klarna_virtuemart();
                 $klarna->config($settings['eid'], $settings['secret'], $settings['country'], $settings['language'], $settings['currency'], KlarnaHandler::getKlarnaMode($method, $settings['country_code_3']), VMKLARNA_PC_TYPE, $pc_type, TRUE);
                 $klarna->fetchPClasses($country);
                 $success .= shopFunctions::getCountryByID($settings['virtuemart_country_id']);
             } catch (Exception $e) {
                 $message .= $flag . " " . shopFunctions::getCountryByID($settings['virtuemart_country_id']) . ": " . $e->getMessage() . ' Error Code #' . $e->getCode() . '</span></br>';
             }
         }
     }
     $results['msg'] = $message;
     $results['notice'] = $success;
     return $results;
     //echo $notice;
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:44,代码来源:klarnahandler.php

示例5: updateCartWithAmazonAddress

	/**
	 * get the partial shipping address (city, state, postal code, and country) by calling the GetOrderReferenceDetails operation
	 * to compute taxes and shipping costs or possible applicable shipping speed, and options.
	 * @param $client
	 * @param $cart
	 */
	function updateCartWithAmazonAddress () {

		$this->loadVmClass('VirtueMartCart', JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
		$return = array();
		//$this->debug('', 'updateCartWithAmazonAddress', 'debug');
		$cart = VirtueMartCart::getCart();

		$physicalDestination = $this->getPhysicalDestination();
		if (!$physicalDestination) {
			$return['error'] = 'NoPhysicalDestination';
			$return['error_msg'] = vmText::_('VMPAYMENT_AMAZON_UPDATECART_ERROR');
			return $return;
		}

		$update_data = $this->getUserInfoFromAmazon($physicalDestination);
		if (!$this->isValidCountry($update_data['virtuemart_country_id'])) {
			$this->updateCartWithDefaultAmazonAddress($cart, $this->isOnlyDigitalGoods($cart));
			$country = shopFunctions::getCountryByID($update_data['virtuemart_country_id']);
			$cart->_dataValidated = false;
			$cart->BT['virtuemart_country_id'] = 0;
			$cart->setCartIntoSession();
			$return['error'] = 'deliveryCountryNotAllowed';
			$return['error_msg'] = vmText::sprintf('VMPAYMENT_AMAZON_UPDATECART_DELIVERYCOUNTRYNOTALLOWED', $country);
			return $return;

		}
		if ($this->isSameAddress($update_data, $cart)) {
			$return['error'] = 'sameAddress';
			return $return;

		}
		$update_data ['address_type'] = 'BT';
		$cart->saveAddressInCart($update_data, $update_data['address_type'], TRUE);


		// update BT and ST with Amazon Partial Address
		$prefix = 'shipto_';
		$update_data = $this->getUserInfoFromAmazon($physicalDestination, $prefix);
		$update_data ['address_type'] = 'ST';
		$cart->saveAddressInCart($update_data, $update_data['address_type'], TRUE);
		$cart->STsameAsBT = 0;
		$cart->setCartIntoSession();

		$return['error'] = 'addressUpdated';
		return $return;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:52,代码来源:amazon.php

示例6: setCountryAndState

 function setCountryAndState($address)
 {
     // get rid of the references
     $address = $this->copyObj($address);
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     if (isset($address) && !is_object($address) || !is_object($address) && empty($address->virtuemart_country_id)) {
         if (!empty($address['virtuemart_country_id']) && !empty($address['virtuemart_country_id']['value']) && is_numeric($address['virtuemart_country_id']['value'])) {
             $address['virtuemart_country_id']['value_txt'] = shopFunctions::getCountryByID($address['virtuemart_country_id']['value']);
             //shopFunctions::getCountryByID($address['virtuemart_country_id']['value']);
         } else {
             $address['virtuemart_country_id']['value'] = '';
         }
         if (!empty($address['virtuemart_state_id']) && !empty($address['virtuemart_state_id']['value']) && is_numeric($address['virtuemart_state_id']['value'])) {
             $address['virtuemart_state_id']['value_txt'] = shopFunctions::getStateByID($address['virtuemart_state_id']['value']);
         } else {
             $address['virtuemart_state_id']['value'] = '';
         }
     } else {
         if (!empty($address->virtuemart_country_id) && is_numeric($address->virtuemart_country_id)) {
             $address->virtuemart_country_id = shopFunctions::getCountryByID($address->virtuemart_country_id);
         } else {
             $address->virtuemart_country_id = '';
         }
         if (!empty($address->virtuemart_state_id) && is_numeric($address->virtuemart_state_id)) {
             $address->virtuemart_state_id = shopFunctions::getStateByID($address->virtuemart_state_id);
         } else {
             $address->virtuemart_state_id = '';
         }
     }
     return $address;
 }
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:33,代码来源:loader.php

示例7: setShopperGroupsController

 public static function setShopperGroupsController($cart = null)
 {
     // we need to alter shopper group for business when set to:
     $is_business = JRequest::getVar('opc_is_business', 0);
     $remove = array();
     //require_once(JPATH_OPC.DS.'helpers'.DS.'loader.php');
     OPCShopperGroups::getSetShopperGroup();
     if (!class_exists('VirtueMartModelShopperGroup')) {
         if (file_exists(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'shoppergroup.php')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'shoppergroup.php';
         } else {
             return;
         }
     }
     if (!method_exists('VirtueMartModelShopperGroup', 'appendShopperGroups')) {
         return 1;
     }
     include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     if (!empty($business_shopper_group) || !empty($visitor_shopper_group)) {
         if (class_exists('VirtueMartModelShopperGroup')) {
             $shoppergroupmodel = new VirtueMartModelShopperGroup();
             if (method_exists($shoppergroupmodel, 'removeSessionSgrps')) {
                 if (method_exists($shoppergroupmodel, 'appendShopperGroups')) {
                     if (!empty($is_business)) {
                         // we will differenciate between default and anonymous shopper group
                         // default is used for non-logged users
                         // anononymous is used for logged in users as guests
                         OPCShopperGroups::setShopperGroups($business_shopper_group);
                         $remove[] = $visitor_shopper_group;
                         // function appendShopperGroups(&$shopperGroups,$user,$onlyPublished = FALSE,$vendorId=1){
                         // remove previous:
                         /*
                         $session = JFactory::getSession();
                         $shoppergroup_ids = $session->get('vm_shoppergroups_add',array(),'vm');
                         $shoppergroupmodel->removeSessionSgrps($shoppergroup_ids); 
                         $new_shoppergroups = array(); 
                         $new_shoppergroups[] = $business_shopper_group;  
                         $shoppergroup_ids = $session->set('vm_shoppergroups_add',$new_shoppergroups,'vm');
                         $shoppergroupmodel->appendShopperGroups($new_shoppergroups, null); 
                         
                         JRequest::setVar('virtuemart_shoppergroup_id', $new_shoppergroups, 'post');
                         */
                         //appendShopperGroups
                     } else {
                         OPCShopperGroups::setShopperGroups($visitor_shopper_group);
                         $remove[] = $business_shopper_group;
                         /*
                         	 $shoppergroupmodel = new VirtueMartModelShopperGroup(); 
                         	 // function appendShopperGroups(&$shopperGroups,$user,$onlyPublished = FALSE,$vendorId=1){
                         	 // remove previous: 
                         	 $session = JFactory::getSession();
                         	 $shoppergroup_ids = $session->get('vm_shoppergroups_add',array(),'vm');
                         	 $shoppergroupmodel->removeSessionSgrps($shoppergroup_ids); 
                         	 $new_shoppergroups = array(); 
                         	 $new_shoppergroups[] = $visitor_shopper_group; 
                         	 $shoppergroup_ids = $session->set('vm_shoppergroups_add',$new_shoppergroups,'vm');
                         	 $shoppergroupmodel->appendShopperGroups($new_shoppergroups, null); 
                         	 JRequest::setVar('virtuemart_shoppergroup_id', $new_shoppergroups, 'post');
                         */
                     }
                 }
             }
         }
     }
     // EU VAT shopper group:
     if (!empty($euvat_shopper_group)) {
         $removeu = true;
         $session = JFactory::getSession();
         $vatids = $session->get('opc_vat', array());
         if (!is_array($vatids)) {
             $vatids = @unserialize($vatids);
         }
         //BIT vat checker:
         if (!empty($vatids['field'])) {
             $euvat = JRequest::getVar($vatids['field'], '');
             $euvat = preg_replace("/[^a-zA-Z0-9]/", "", $euvat);
             $euvat = strtoupper($euvat);
             if (!empty($cart)) {
                 $address = $cart->ST == 0 ? $cart->BT : $cart->ST;
                 $country = $address['virtuemart_country_id'];
             } else {
                 $country = JRequest::getVar('virtuemart_country_id');
             }
             $vathash = $country . '_' . $euvat;
             $home = 'NL';
             if (!class_exists('ShopFunctions')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
             }
             $country_2_code = shopFunctions::getCountryByID($country, 'country_2_code');
             $home = explode(',', $home_vat_countries);
             $list = array();
             if (is_array($home)) {
                 foreach ($home as $k => $v) {
                     $list[] = strtoupper(trim($v));
                 }
             } else {
                 $list[] = $v;
             }
             if (!in_array($country_2_code, $list)) {
                 if (!empty($euvat)) {
//.........这里部分代码省略.........
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:101,代码来源:shoppergroups.php

示例8: plgVmDisplayListFEPaymentOPCNocache

 public function plgVmDisplayListFEPaymentOPCNocache(&$cart, $selected = 0, &$htmlIn)
 {
     if ($this->_psType != 'payment') {
         return;
     }
     if (!isset($cart->vendorId)) {
         $cart->vendorId = 1;
     }
     if (!class_exists('CurrencyDisplay')) {
         require JPATH_VM_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'currencydisplay.php';
     }
     $currency = CurrencyDisplay::getInstance();
     if ($this->_name == 'klarna') {
         $address = $cart->ST == 0 ? $cart->BT : $cart->ST;
         if (isset($address['virtuemart_country_id'])) {
             $country = $address['virtuemart_country_id'];
         }
         if (empty($country) && !empty($cart->BT['virtuemart_country_id'])) {
             $country = $cart->BT['virtuemart_country_id'];
         }
         if (!class_exists('ShopFunctions')) {
             require JPATH_VM_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'shopfunctions.php';
         }
         if (empty($country)) {
             return;
         }
         $countryCode = shopFunctions::getCountryByID($country, 'country_2_code');
         $avai = array('SE', 'DE', 'NL', 'NO', 'DK', 'FI');
         $countryCode = strtoupper($countryCode);
         if (!in_array($countryCode, $avai)) {
             return;
         }
     }
     if ($this->getPluginMethodsOPC($cart->vendorId) === 0) {
         return FALSE;
     }
     $return = array();
     if (isset($this->methods)) {
         $ref =& $this;
         foreach ($this->methods as $key => &$method) {
             if (isset($method->virtuemart_paymentmethod_id)) {
                 $this->_setMissingOPC($method);
                 $vm_id = $method->virtuemart_paymentmethod_id;
                 $html = '';
                 //$filename = 'plg_' . $this->_type . '_' . $this->_name;
                 $name = $this->_name;
                 jimport('joomla.filesystem.file');
                 $name = JFile::makeSafe($name);
                 $type = $this->_psType;
                 if ($type == 'vmpayment') {
                     $type = 'payment';
                 }
                 if ($type == 'vmshipment') {
                     $type = 'shipment';
                 }
                 $type = JFile::makeSafe($type);
                 static $theme;
                 if (empty($theme)) {
                     include JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'onepage.cfg.php';
                     $theme = $selected_template;
                 }
                 $layout_name = 'after_render';
                 $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php';
                 if (file_exists($layout)) {
                     $method_name = $this->_psType . '_name';
                     $plugin =& $method;
                     $pluginmethod_id = $this->_idName;
                     $plugin_name = $this->_psType . '_name';
                     $plugin_desc = $this->_psType . '_desc';
                     $logosFieldName = $this->_psType . '_logos';
                     $logo_list = $plugin->{$logosFieldName};
                     $pricesUnformatted = $cart->pricesUnformatted;
                     $arr = array($this, 'setCartPrices');
                     if (is_callable($arr)) {
                         $pluginSalesPrice = $this->setCartPrices($cart, $pricesUnformatted, $method);
                     } else {
                         $pluginSalesPrice = 0;
                     }
                     $url = JURI::root() . 'images/stories/virtuemart/' . $this->_psType . '/';
                     if (!is_array($logo_list)) {
                         $logo_list = (array) $logo_list;
                     }
                     $name = JFile::makeSafe($name);
                     $layout_name = JFile::makeSafe($layout_name);
                     ob_start();
                     include $layout;
                     if (!empty($html)) {
                         $null = ob_get_clean();
                     } else {
                         $html = ob_get_clean();
                     }
                     $isset = true;
                 } else {
                     OPCtransform::overridePaymentHtml($html, $cart, $vm_id, $this->_name, $this->_type, $method);
                 }
                 if ($html != '') {
                     $return[] = $html;
                 }
                 //break;
             }
//.........这里部分代码省略.........
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:101,代码来源:vmplugin.php

示例9: fetchPClasses

 public static function fetchPClasses($method)
 {
     $message = '';
     $success = '';
     $results = array();
     $countries = self::getKlarnaCountries();
     foreach ($countries as $country) {
         $active_country = "klarna_active_" . $country;
         if ($method->{$active_country}) {
             // country is CODE 3==> converting to 2 letter country
             //$country = self::convertCountryCode($method, $country);
             $lang = self::getLanguageForCountry($method, $country);
             $flagImg = JURI::root(true) . '/administrator/components/com_virtuemart/assets/images/flag/' . strtolower($lang) . '.png';
             $flag = "<img src='" . $flagImg . "' />";
             try {
                 $settings = self::getCountryData($method, $country);
                 $klarna = new Klarna_virtuemart();
                 $klarna->config($settings['eid'], $settings['secret'], $settings['country'], $settings['language'], $settings['currency'], KlarnaHandler::getKlarnaMode($method), VMKLARNA_PC_TYPE, KlarnaHandler::getKlarna_pc_type(), true);
                 // fetch pclass from file
                 $klarna->fetchPClasses($country);
                 $success .= '<span style="padding: 5px;">' . $flag . " " . shopFunctions::getCountryByID($settings['virtuemart_country_id']) . '</span>';
             } catch (Exception $e) {
                 $message .= '<br><span style="font-size: 15px;">' . $flag . " " . shopFunctions::getCountryByID($settings['virtuemart_country_id']) . ": " . $e->getMessage() . ' Error Code #' . $e->getCode() . '</span></br>';
             }
         }
     }
     $results['msg'] = $message;
     $results['notice'] = 'PClasses fetched for : ' . $success;
     return $results;
     //echo $notice;
 }
开发者ID:joselapria,项目名称:virtuemart,代码行数:31,代码来源:klarnahandler.php


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