本文整理汇总了PHP中Country::getIsoById方法的典型用法代码示例。如果您正苦于以下问题:PHP Country::getIsoById方法的具体用法?PHP Country::getIsoById怎么用?PHP Country::getIsoById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Country
的用法示例。
在下文中一共展示了Country::getIsoById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->name = 'paypal';
$this->tab = 'payments_gateways';
$this->version = '2.4';
$this->currencies = true;
$this->currencies_mode = 'radio';
parent::__construct();
$this->_errors = array();
$this->page = basename(__FILE__, '.php');
$this->displayName = $this->l('PayPal');
$this->description = $this->l('Accepts payments by credit cards (CB, Visa, MasterCard, Amex, Aurore, Cofinoga, 4 stars) with PayPal.');
$this->confirmUninstall = $this->l('Are you sure you want to delete your details?');
if (Configuration::get('PAYPAL_BUSINESS') == 'paypal@prestashop.com') {
$this->warning = $this->l('You are currently using the default PayPal e-mail address, please enter your own e-mail address.');
}
$this->_checkAndUpdateFromOldVersion();
if (file_exists(_PS_ROOT_DIR_ . '/modules/paypalapi/paypalapi.php') and $this->active) {
$this->warning = $this->l('In order to REMOVE this warning, please uninstall and remove the PayPalAPI module.');
}
global $cookie;
$context = stream_context_create(array('http' => array('method' => "GET", 'timeout' => 5)));
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country=' . Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) . '&iso_lang=' . Tools::strtolower(Language::getIsoById(intval($cookie->id_lang))) . '&id_lang=' . (int) $cookie->id_lang . '&email=' . urlencode(Configuration::get('PS_SHOP_EMAIL')) . '&security=' . md5(Configuration::get('PS_SHOP_EMAIL') . _COOKIE_IV_), false, $context);
$content = explode('|', $content);
if ($content[0] == 'OK') {
if (!empty($this->warning)) {
$this->warning .= ', ';
}
$this->warning .= $content[1];
}
}
示例2: isApplicable
public static function isApplicable($id_country)
{
$isApplicable = in_array(Country::getIsoById((int) $id_country), VatNumber::getPrefixIntracomVAT());
if ($isApplicable == "") {
return 0;
}
return 1;
}
示例3: install
public function install()
{
if (false === function_exists('curl_init')) {
$this->_errors[] = $this->l('This module requires the cURL PHP extension to work, it is not enabled on your server.') . ' ' . $this->l('Please ask your web hosting provider for assistance.');
return false;
}
$iso_code = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
if (in_array($iso_code, $this->limited_countries) == false) {
$this->_errors[] = $this->l('This module is not available in your country');
return false;
}
return parent::install() && $this->registerHook('displayPayment') && $this->registerHook('displayPaymentReturn') && $this->registerHook('actionOrderStatusUpdate') && $this->installDefaultValues() && $this->installOrderState();
}
示例4: checkMobileNeeds
protected function checkMobileNeeds()
{
$allow_mobile = (bool) Configuration::get('PS_ALLOW_MOBILE_DEVICE');
if (!$allow_mobile && Context::getContext()->shop->getTheme() == 'default') {
return;
}
$iso_code = Country::getIsoById((int) Configuration::get('PS_COUNTRY_DEFAULT'));
$paypal_installed = (bool) Module::isInstalled('paypal');
$paypal_countries = array('ES', 'FR', 'PL', 'IT');
if (!$paypal_installed && in_array($iso_code, $paypal_countries)) {
$this->warnings[] = $this->l('The mobile theme only works with the PayPal\'s payment module at this time. Please activate the module to enable payments.') . '<br>' . $this->l('In order to use the mobile theme you have to install and configure the PayPal module.');
}
}
示例5: install
/**
* Don't forget to create update methods if needed:
* http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update
*/
public function install()
{
if (extension_loaded('curl') == false) {
$this->_errors[] = $this->l('You have to enable the cURL extension on your server to install this module');
return false;
}
$iso_code = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
if (in_array($iso_code, $this->limited_countries) == false) {
$this->_errors[] = $this->l('This module is not available in your country');
return false;
}
Configuration::updateValue('EGYAPAYE_LIVE_MODE', false);
return parent::install() && $this->registerHook('header') && $this->registerHook('backOfficeHeader') && $this->registerHook('payment') && $this->registerHook('paymentReturn') && $this->registerHook('actionPaymentConfirmation');
}
示例6: install
public function install()
{
if (extension_loaded('curl') == false) {
$this->_errors[] = $this->l('You have to enable the cURL extension on your server to install this module');
return false;
}
$iso_code = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
if (in_array($iso_code, $this->limited_countries) == false) {
$this->_errors[] = $this->l('This module is not available in your country');
return false;
}
Configuration::updateValue('APLAZAME_LIVE_MODE', false);
return parent::install() && $this->registerHook('payment') && $this->registerHook('paymentReturn') && $this->registerHook('actionProductCancel') && $this->registerHook('actionOrderDetail') && $this->registerHook('actionOrderStatusPostUpdate') && $this->registerHook('actionOrderStatusUpdate') && $this->registerHook('actionPaymentConfirmation') && $this->registerHook('actionValidateOrder') && $this->registerHook('displayBeforePayment') && $this->registerHook('displayFooter') && $this->registerHook('displayAdminOrder') && $this->registerHook('displayOrderConfirmation') && $this->registerHook('displayPayment') && $this->registerHook('displayPaymentReturn');
}
示例7: init
public function init()
{
$address = new Address($this->_id_address_delivery);
$weight = $this->_mondialRelay->account_shop['MR_WEIGHT_COEFFICIENT'] * $this->_weight;
if (!$address) {
throw new Exception($this->_mondialrelay->l('Customer address can\'t be found'));
}
$this->_fields['list']['Enseigne']['value'] = $this->_mondialRelay->account_shop['MR_ENSEIGNE_WEBSERVICE'];
$this->_fields['list']['Poids']['value'] = $weight < 100 ? 100 : $weight;
$this->_fields['list']['Pays']['value'] = trim(Country::getIsoById($address->id_country));
$this->_fields['list']['Ville']['value'] = trim($address->city);
$this->_fields['list']['CP']['value'] = trim($address->postcode);
$this->_fields['list']['CP']['params']['id_country'] = $address->id_country;
$this->_generateMD5SecurityKey();
unset($address);
}
示例8: init
public function init()
{
$this->_mondialRelay = new MondialRelay();
$address = new Address($this->_id_address_delivery);
if (!$address) {
throw new Exception($this->_mondialrelay->l('Customer address can\'t be found'));
}
$this->_fields['list']['Enseigne']['value'] = Configuration::get('MR_ENSEIGNE_WEBSERVICE');
$this->_fields['list']['Poids']['value'] = Configuration::get('MR_WEIGHT_COEF') * $this->_weight;
$this->_fields['list']['Pays']['value'] = Country::getIsoById($address->id_country);
$this->_fields['list']['Ville']['value'] = $address->city;
$this->_fields['list']['CP']['value'] = $address->postcode;
$this->_fields['list']['CP']['params']['id_country'] = $address->id_country;
$this->_generateMD5SecurityKey();
unset($address);
}
示例9: checkZipcodeByCountry
public static function checkZipcodeByCountry($zipcode, $params)
{
$id_country = $params['id_country'];
$zipcodeFormat = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `zip_code_format`
FROM `' . _DB_PREFIX_ . 'country`
WHERE `id_country` = ' . (int) $id_country);
// Skip the cheking format if doesn't exist
if (!$zipcodeFormat) {
return true;
}
$regxMask = str_replace(array('N', 'C', 'L'), array('[0-9]', Country::getIsoById((int) $id_country), '[a-zA-Z]'), $zipcodeFormat);
if (preg_match('/' . $regxMask . '/', $zipcode)) {
return true;
}
return false;
}
示例10: install
public function install()
{
if (!extension_loaded('curl')) {
$this->_errors[] = $this->l('You have to enable the cURL extension on your server to install this module');
return false;
}
$iso_code = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
if (!in_array($iso_code, $this->limited_countries)) {
$this->_errors[] = $this->l('This module is not available in your country');
return false;
}
Configuration::updateValue('APLAZAME_SANDBOX', false);
Configuration::updateValue('APLAZAME_BUTTON_IMAGE', 'white-148x46');
Configuration::updateValue('APLAZAME_BUTTON', '#aplazame_payment_button');
Configuration::updateValue('APLAZAME_WIDGET_PROD', '0');
return parent::install() && $this->registerHook('actionOrderSlipAdd') && $this->registerHook('actionOrderStatusPostUpdate') && $this->registerHook('displayAdminProductsExtra') && $this->registerHook('displayHeader') && $this->registerHook('displayPayment') && $this->registerHook('displayProductButtons') && $this->registerHook('displayRightColumn') && $this->registerHook('displayRightColumnProduct') && $this->registerHook('displayShoppingCart') && $this->registerHook('payment') && $this->registerHook('paymentOptions') && $this->registerHook('paymentReturn') && $this->registerController('AdminAplazameApiProxy', 'Aplazame API Proxy');
}
示例11: getByIdCountry
/**
* Get SmKialaCountry object by id_country
*
* @param int $id_country
* @return boolean|SmKialaCountry fetched object or false
*/
public static function getByIdCountry($id_country)
{
// Luxemburg is grouped with Belgium by Kiala
if (Country::getIsoById($id_country) == 'LU') {
$id_country = Country::getByIso('BE');
}
$result = Db::getInstance()->getRow('
SELECT `id_sm_kiala_country`, `id_country`, `dspid`, `sender_id`, `password`, `preparation_delay`, `active`
FROM `' . _DB_PREFIX_ . 'sm_kiala_country`
WHERE `id_country` = ' . (int) $id_country);
if (!$result) {
return false;
}
$kiala_country = new self();
$kiala_country->setData($result);
return $kiala_country;
}
示例12: getInfosForm
private function getInfosForm($account = false)
{
$infos = array();
$realex = new RealexRedirect();
$cart = $this->context->cart;
$id_customer = $cart->id_customer;
$customer = new Customer((int) $id_customer);
$infos['customer'] = $customer;
$infos['iso_currency'] = $this->context->currency->iso_code;
$date = new DateTime();
$infos['timestamp'] = $date->format('YmdHis');
$infos['order_id'] = $cart->id . '-' . $infos['timestamp'];
$infos['settlement'] = $realex->settlement == 'auto' ? 1 : 0;
if ($account) {
$sql = 'SELECT dcc_realex_subaccount FROM `' . _DB_PREFIX_ . 'realex_subaccount` WHERE name_realex_subaccount = "' . pSQL($account) . '"';
$result = Db::getInstance()->getRow($sql);
$infos['settlement'] = $result['dcc_realex_subaccount'] || $realex->settlement == 'auto' ? 1 : 0;
}
if (!$customer->is_guest) {
$sql = 'SELECT `id_realex_payerref`,`refuser_realex` FROM `' . _DB_PREFIX_ . 'realex_payerref` WHERE `id_user_realex` = ' . $id_customer;
$payer_ref = Db::getInstance()->getRow($sql);
$infos['payer_exists'] = !empty($payer_ref['refuser_realex']) ? 1 : 0;
$infos['ref_payer'] = !empty($payer_ref['refuser_realex']) ? $payer_ref['refuser_realex'] : $id_customer . $infos['timestamp'];
$infos['id_realex_payerref'] = $payer_ref['id_realex_payerref'];
}
$billing_adresse = new Address((int) $cart->id_address_invoice);
$infos['billing_streetumber'] = $this->parseInt($billing_adresse->address1);
$infos['billing_co'] = Country::getIsoById($billing_adresse->id_country);
$infos['billing_postcode'] = $this->parseInt($billing_adresse->postcode);
$shipping_adresse = new Address((int) $cart->id_address_delivery);
$infos['shipping_streetumber'] = $this->parseInt($shipping_adresse->address1);
$infos['shipping_co'] = Country::getIsoById($shipping_adresse->id_country);
$infos['shipping_postcode'] = $this->parseInt($shipping_adresse->postcode);
$infos['cart'] = $cart;
if ($realex->realvault == '1' && !$customer->is_guest) {
$times = $infos['timestamp'];
$chaine = $times . '.' . $realex->merchant_id . '.' . $infos['order_id'] . '.' . $realex->getAmountFormat($cart->getOrderTotal(true, Cart::BOTH));
$chaine .= '.' . $infos['iso_currency'] . '.' . $infos['ref_payer'] . '.' . $cart->id . $infos['timestamp'];
} else {
$chaine = $infos['timestamp'] . '.' . $realex->merchant_id . '.' . $infos['order_id'];
$chaine .= '.' . $realex->getAmountFormat($cart->getOrderTotal(true, Cart::BOTH)) . '.' . $infos['iso_currency'];
}
$sha1_temp_new = sha1($chaine);
$infos['sha1_new'] = sha1($sha1_temp_new . '.' . $realex->shared_secret);
return $infos;
}
示例13: getPrice
public static function getPrice($total_weight, $id_carrier, $cart)
{
$iso_country = '';
if ($id_country = (int) Tools::getValue('id_country')) {
$iso_country = Country::getIsoById($id_country);
} else {
$address = new Address((int) $cart->id_address_delivery);
$iso_country = Country::getIsoById((int) $address->id_country);
}
$price_rules = DB::getInstance()->executeS('
SELECT `parcel_price`, `cod_price`, `iso_country`
FROM `' . _DB_PREFIX_ . _DPDPOLAND_PRICE_RULE_DB_ . '`
WHERE (`iso_country` = "' . pSQL($iso_country) . '" OR `iso_country` = "*")
AND `weight_from` <= "' . pSQL($total_weight) . '"
AND `weight_to` >= "' . pSQL($total_weight) . '"
AND `id_carrier` = "' . (int) $id_carrier . '"
AND `id_shop` = "' . (int) Context::getContext()->shop->id . '"
');
if (!$price_rules) {
return false;
}
$available_prices_count = count($price_rules);
for ($i = 0; $i < $available_prices_count; $i++) {
if ($price_rules[$i]['iso_country'] != '*' && !Country::getByIso($price_rules[$i]['iso_country'])) {
//if country is not deleted
unset($price_rules[$i]);
}
}
if (!$price_rules) {
return false;
}
$price_rules = $price_rules[0];
//accept first matching rule
if (!$price_rules['cod_price']) {
$price_rules['cod_price'] = 0;
}
//CSV validation allows empty value of COD price
$price = $price_rules['parcel_price'];
if ($id_carrier == _DPDPOLAND_STANDARD_COD_ID_) {
$price += $price_rules['cod_price'];
}
return $price;
}
示例14: formatEntityToXML
/**
* Convert the entities data into an xml object and return the xml object as a string
*
* @param array $aEntity Entity data
*/
public function formatEntityToXML($aEntity)
{
$dom = new DOMDocument('1.0', 'utf-8');
// Set the root of the XML
$root = $dom->createElement($this->sEntity);
$dom->appendChild($root);
$oCustomer = new Customer((int) $aEntity['id_customer']);
// Check if the customer has visited the website since a specific number of days $this->nbDaysCustomerValid
$aLastConnection = $oCustomer->getLastConnections();
if ($aLastConnection[0]['date_add'] < date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') - (int) $this->nbDaysCustomerValid, date('Y')))) {
$this->nbEntitiesTreated--;
$this->nbEntities--;
return ' ';
}
unset($aLastConnection);
$id = $dom->createElement('id', (int) $oCustomer->id);
$root->appendChild($id);
if (($sBirthday = strtotime($oCustomer->birthday)) && !empty($sBirthday)) {
$dobyear = $dom->createElement('dobyear', date('Y', $sBirthday));
$root->appendChild($dobyear);
}
$gender = $dom->createElement('gender', (int) $oCustomer->id_gender == 1 ? 'male' : 'female');
$root->appendChild($gender);
$oAddress = new Address((int) Address::getFirstCustomerAddressId((int) $oCustomer->id));
unset($oCustomer);
if (($sLocation = trim($oAddress->city)) && !empty($sLocation)) {
$location = $dom->createElement('location', $sLocation);
$root->appendChild($location);
}
if (($sCountry = Country::getIsoById((int) $oAddress->id_country)) && !empty($sCountry)) {
$country = $dom->createElement('country', $sCountry);
$root->appendChild($country);
}
$sReturn = $dom->saveHTML();
unset($oAddress);
unset($dom);
return $sReturn;
}
示例15: isApplicable
public static function isApplicable($id_country)
{
return ((int) $id_country and in_array(Country::getIsoById($id_country), self::getPrefixIntracomVAT())) ? 1 : 0;
}