Пример #1
0
 /**
  * @static
  * @param $method
  * @param $address
  * @return array|null
  */
 static function getcData($method, $address)
 {
     if (!isset($address['virtuemart_country_id'])) {
         $vendor_country = KlarnaHandler::getVendorCountry();
         $cData = self::countryData($method, $vendor_country);
     } else {
         $cart_country_code_3 = ShopFunctions::getCountryByID($address['virtuemart_country_id'], 'country_3_code');
         // the user gave an address, get info according to his country
         $cData = self::countryData($method, $cart_country_code_3);
     }
     return $cData;
 }
Пример #2
0
	/**
	 * @param        $cart
	 * @param        $countryCode
	 * @param        $countryId
	 * @param string $fld
	 */
	function _getCountryCode ($cart = NULL, &$countryCode, &$countryId, $fld = 'country_3_code') {

		if ($cart == '') {
			if (!class_exists ('VirtueMartCart')) {
				require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
			}
			$cart = VirtueMartCart::getCart ();
		}
		$type = NULL;
		$address = $this->getCartAddress ($cart, $type, FALSE);
		if (JRequest::getVar ('klarna_country_2_code') == 'se') {
			$countryId = ShopFunctions::getCountryIDByName ('se');
			$countryCode = shopFunctions::getCountryByID ($countryId, $fld);
		} elseif (!isset($address['virtuemart_country_id']) or empty($address['virtuemart_country_id'])) {
			$countryCode = KlarnaHandler::getVendorCountry ($fld);
			$countryId = ShopFunctions::getCountryIDByName ($countryCode);
		} else {
			$countryId = $address['virtuemart_country_id'];
			$countryCode = shopFunctions::getCountryByID ($address['virtuemart_country_id'], $fld);
		}
	}