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


PHP Country::getNameById方法代码示例

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


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

示例1: assignStoresSimplified

    /**
     * Assign template vars for simplified stores
     */
    protected function assignStoresSimplified()
    {
        $stores = Db::getInstance()->executeS('
		SELECT s.*, cl.name country, st.iso_code state
		FROM ' . _DB_PREFIX_ . 'store s
		' . Shop::addSqlAssociation('store', 's') . '
		LEFT JOIN ' . _DB_PREFIX_ . 'country_lang cl ON (cl.id_country = s.id_country)
		LEFT JOIN ' . _DB_PREFIX_ . 'state st ON (st.id_state = s.id_state)
		WHERE s.active = 1 AND cl.id_lang = ' . (int) $this->context->language->id);
        $addresses_formated = array();
        foreach ($stores as &$store) {
            $address = new Address();
            $address->country = Country::getNameById($this->context->language->id, $store['id_country']);
            $address->address1 = $store['address1'];
            $address->address2 = $store['address2'];
            $address->postcode = $store['postcode'];
            $address->city = $store['city'];
            $addresses_formated[$store['id_store']] = AddressFormat::getFormattedLayoutData($address);
            $store['has_picture'] = file_exists(_PS_STORE_IMG_DIR_ . (int) $store['id_store'] . '.jpg');
            if ($working_hours = $this->renderStoreWorkingHours($store)) {
                $store['working_hours'] = $working_hours;
            }
        }
        $this->context->smarty->assign(array('simplifiedStoresDiplay' => true, 'stores' => $stores, 'addresses_formated' => $addresses_formated));
    }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:28,代码来源:StoresController.php

示例2: __construct

 /**
  * Build an address
  *
  * @param int $id_address Existing address id in order to load object (optional)
  */
 public function __construct($id_address = null, $id_lang = null)
 {
     parent::__construct($id_address);
     /* Get and cache address country name */
     if ($this->id) {
         $this->country = Country::getNameById($id_lang ? $id_lang : Configuration::get('PS_LANG_DEFAULT'), $this->id_country);
     }
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:13,代码来源:Address.php

示例3: install

 public function install()
 {
     Configuration::updateValue('BLOCKCONTACTINFOS_COMPANY', Configuration::get('PS_SHOP_NAME'));
     Configuration::updateValue('BLOCKCONTACTINFOS_ADDRESS', trim(preg_replace('/ +/', ' ', Configuration::get('PS_SHOP_ADDR1') . ' ' . Configuration::get('PS_SHOP_ADDR2') . "\n" . Configuration::get('PS_SHOP_CODE') . ' ' . Configuration::get('PS_SHOP_CITY') . "\n" . Country::getNameById(Configuration::get('PS_LANG_DEFAULT'), Configuration::get('PS_SHOP_COUNTRY_ID')))));
     Configuration::updateValue('BLOCKCONTACTINFOS_PHONE', Configuration::get('PS_SHOP_PHONE'));
     Configuration::updateValue('BLOCKCONTACTINFOS_EMAIL', Configuration::get('PS_SHOP_EMAIL'));
     $this->_clearCache('blockcontactinfos.tpl');
     return parent::install() && $this->registerHook('header') && $this->registerHook('footer');
 }
开发者ID:zangles,项目名称:lennyba,代码行数:9,代码来源:blockcontactinfos.php

示例4: getStateName

 public function getStateName($echo, $row)
 {
     $id_state = $row['id_state'];
     $state = new State($id_state);
     $cn = new Country(177);
     if ($state->id) {
         $country = Country::getNameById(Context::getContext()->language->id, $state->id_country);
         return "{$state->name} ({$country})";
     }
     return $this->l('Out of the World');
 }
开发者ID:qant,项目名称:russianpostcarrier,代码行数:11,代码来源:adminrussianpost.php

示例5: displayAccount

 public function displayAccount()
 {
     $api = MailjetTemplate::getApi();
     // Traitements
     //$tracking = $api->getTracking();
     $infos = $api->getUser();
     $sendersFromApi = $api->getSenders(null, $infos);
     $is_senders = 0;
     $is_domains = 0;
     $domains = array();
     $domains = array();
     $senders = array();
     if ($sendersFromApi) {
         foreach ($sendersFromApi as $sender) {
             if (strpos($sender->Email->Email, '*') !== false) {
                 $domains[] = $sender;
             } else {
                 $senders[] = $sender;
             }
             $is_senders = 1;
             if (isset($sender->DNS)) {
                 if ($sender->DNS->Domain == Configuration::get('PS_SHOP_DOMAIN') || $sender->DNS->Domain == Configuration::get('PS_SHOP_DOMAIN_SSL')) {
                     $available_domain = 1;
                     if (file_exists(_PS_ROOT_DIR_ . $sender->Filename)) {
                         $root_file = 1;
                     }
                 }
                 if (isset($sender->DNS->Domain)) {
                     $is_domains = 1;
                 }
             }
         }
     }
     $iso = !empty($infos->AddressCountry) ? $infos->AddressCountry : 'fr';
     $country = Country::getNameById($this->context->language->id, Country::getByIso($iso));
     $language = explode('_', $infos->Locale);
     $language = Tools::strtoupper($language[0]);
     // countries list
     $countries = Country::getCountries($this->context->language->id);
     // Assign
     $this->context->smarty->assign(array('countries' => $countries, 'infos' => $infos, 'country' => $country, 'language' => $language, 'domains' => $domains, 'sender' => $senders, 'is_senders' => $is_senders, 'is_domains' => $is_domains, 'root_file' => $root_file, 'available_domain' => $available_domain));
 }
开发者ID:ac3gam3r,项目名称:Maxokraft,代码行数:42,代码来源:mailjet.php

示例6: getContent

 public function getContent()
 {
     $this->_postProcess();
     if (($id_lang = Language::getIdByIso('EN')) == 0) {
         $english_language_id = (int) $this->context->employee->id_lang;
     } else {
         $english_language_id = (int) $id_lang;
     }
     $this->context->smarty->assign(array('PayPal_WPS' => (int) WPS, 'PayPal_HSS' => (int) HSS, 'PayPal_ECS' => (int) ECS, 'PP_errors' => $this->_errors, 'PayPal_logo' => $this->paypal_logos->getLogos(), 'PayPal_allowed_methods' => $this->getPaymentMethods(), 'PayPal_country' => Country::getNameById((int) $english_language_id, (int) $this->default_country), 'PayPal_country_id' => (int) $this->default_country, 'PayPal_business' => Configuration::get('PAYPAL_BUSINESS'), 'PayPal_payment_method' => (int) Configuration::get('PAYPAL_PAYMENT_METHOD'), 'PayPal_api_username' => Configuration::get('PAYPAL_API_USER'), 'PayPal_api_password' => Configuration::get('PAYPAL_API_PASSWORD'), 'PayPal_api_signature' => Configuration::get('PAYPAL_API_SIGNATURE'), 'PayPal_api_business_account' => Configuration::get('PAYPAL_BUSINESS_ACCOUNT'), 'PayPal_express_checkout_shortcut' => (int) Configuration::get('PAYPAL_EXPRESS_CHECKOUT_SHORTCUT'), 'PayPal_in_context_checkout' => (int) Configuration::get('PAYPAL_IN_CONTEXT_CHECKOUT'), 'PayPal_in_context_checkout_merchant_id' => Configuration::get('PAYPAL_IN_CONTEXT_CHECKOUT_M_ID'), 'PayPal_sandbox_mode' => (int) Configuration::get('PAYPAL_SANDBOX'), 'PayPal_payment_capture' => (int) Configuration::get('PAYPAL_CAPTURE'), 'PayPal_country_default' => (int) $this->default_country, 'PayPal_change_country_url' => 'index.php?tab=AdminCountries&token=' . Tools::getAdminTokenLite('AdminCountries') . '#footer', 'Countries' => Country::getCountries($english_language_id), 'One_Page_Checkout' => (int) Configuration::get('PS_ORDER_PROCESS_TYPE'), 'PayPal_integral_evolution_template' => Configuration::get('PAYPAL_HSS_TEMPLATE'), 'PayPal_integral_evolution_solution' => Configuration::get('PAYPAL_HSS_SOLUTION'), 'PayPal_login' => (int) Configuration::get('PAYPAL_LOGIN'), 'PayPal_login_client_id' => Configuration::get('PAYPAL_LOGIN_CLIENT_ID'), 'PayPal_login_secret' => Configuration::get('PAYPAL_LOGIN_SECRET'), 'PayPal_login_tpl' => (int) Configuration::get('PAYPAL_LOGIN_TPL'), 'default_lang_iso' => Language::getIsoById($this->context->employee->id_lang)));
     $this->getTranslations();
     $output = $this->fetchTemplate('/views/templates/admin/back_office.tpl');
     if ($this->active == false) {
         return $output . $this->hookBackOfficeHeader();
     }
     return $output;
 }
开发者ID:ramsam5,项目名称:paypal,代码行数:16,代码来源:paypal.php

示例7: hookDisplayAdminOrder

 public function hookDisplayAdminOrder($params)
 {
     if (!$this->hasShiptomyidOption($params['id_order'])) {
         return;
     }
     $shipto_order = ShiptomyidOrder::getByIdOrder($params['id_order']);
     if (!Validate::isLoadedObject($shipto_order)) {
         return false;
     }
     $order = new Order($shipto_order->id_order);
     if ($order->current_state == self::$os_ps_canceled || $order->current_state == self::$os_cancel) {
         return false;
     }
     $shipto_order->country_name = Country::getNameById($this->context->language->id, $shipto_order->id_country);
     $shipto_order->state_name = State::getNameById($shipto_order->id_state);
     $this->context->smarty->assign(array('shipto_order' => $shipto_order));
     return $this->display($this->_path, 'admin-order.tpl');
 }
开发者ID:ship2myidpresta,项目名称:shiptomyid-1,代码行数:18,代码来源:shiptomyid.php

示例8: hookPayment

 public function hookPayment($params)
 {
     global $cookie;
     $this->_validateErrors = array();
     session_start();
     $_SESSION['params1'] = '';
     $_SESSION['cart_currency'] = '';
     $_SESSION['cart_amount'] = '';
     $_SESSION['params1'] = $params;
     if (!$this->active) {
         return;
     }
     global $smarty;
     $address = new Address(intval($params['cart']->id_address_invoice));
     $customer = new Customer(intval($params['cart']->id_customer));
     $merchant_id = trim(Configuration::get('CCAVENUE_MERCHANT_ID'));
     $access_code = trim(Configuration::get('CCAVENUE_ACCESS_CODE'));
     $encryption_key = trim(Configuration::get('CCAVENUE_ENCRYPTION_KEY'));
     $ccavenue_title = trim(Configuration::get('CCAVENUE_TITLE'));
     $Redirect_Url = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/ccavenue/validation.php';
     $Cancel_Url = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/ccavenue/validation.php';
     $language = 'EN';
     $currency = $this->getCurrency('INR');
     $OrderId = date('Ymdhis') . '-' . intval($params['cart']->id);
     $Amount = $params['cart']->getOrderTotal(true, 3);
     $_SESSION['cart_amount'] = $Amount;
     $default_currency_support_ccavnenue = 'INR';
     $default_currency_id = Db::getInstance()->getValue("\n\t\t\t\t\t\tSELECT `id_currency`\n\t\t\t\t\t\tFROM `" . _DB_PREFIX_ . "currency`\n\t\t\t\t\t\tWHERE `iso_code` = '" . $default_currency_support_ccavnenue . "'");
     $base_currency_id = Configuration::get('PS_CURRENCY_DEFAULT');
     $default_currency = new Currency((int) $default_currency_id);
     $base_currency = new Currency((int) $base_currency_id);
     $base_currency_code = $base_currency->iso_code;
     $current_currency = new Currency((int) $params['cart']->id_currency);
     $_SESSION['cart_currency'] = $params['cart']->id_currency;
     $current_currency_code = $current_currency->iso_code;
     $billing_name = $address->firstname . $address->lastname;
     $billing_address = $address->address1 . $address->address2;
     $billing_city = $address->city;
     $billing_zip = $address->postcode;
     $billing_tel = $address->phone;
     $billing_email = $customer->email;
     $country = new Country(intval($address->id_country));
     $state = new State(intval($address->id_state));
     $billing_state = $state->getNameById($address->id_state);
     $land_id = $params['cart']->id_lang;
     $billing_country = $country->getNameById($land_id, $address->id_country);
     $merchant_param1 = (int) $params['cart']->id;
     $merchant_param2 = date('YmdHis');
     $merchant_param3 = $params['cart']->secure_key;
     $cust_notes_message = Message::getMessageByCartId(intval($params['cart']->id));
     $cust_notes = $cust_notes_message['message'];
     $billing_cust_notes = $cust_notes;
     $delivery_name = '';
     $delivery_address = '';
     $delivery_city = '';
     $delivery_state = '';
     $delivery_tel = '';
     $delivery_zip = '';
     $delivery_country = '';
     $delivery_name = $address->firstname . $address->lastname;
     $delivery_address = $address->address1 . $address->address2;
     $delivery_city = $address->city;
     $delivery_zip = $address->postcode;
     $delivery_tel = $address->phone;
     $delivery_state = $billing_state;
     $delivery_country = $billing_country;
     $merchant_data_array = array();
     $merchant_data_array['merchant_id'] = $merchant_id;
     $merchant_data_array['order_id'] = $OrderId;
     $merchant_data_array['currency'] = 'INR';
     $merchant_data_array['amount'] = $Amount;
     $merchant_data_array['redirect_url'] = $Redirect_Url;
     $merchant_data_array['cancel_url'] = $Cancel_Url;
     $merchant_data_array['language'] = $language;
     $merchant_data_array['billing_name'] = $billing_name;
     $merchant_data_array['billing_address'] = $billing_address;
     $merchant_data_array['billing_city'] = $billing_city;
     $merchant_data_array['billing_state'] = $billing_state;
     $merchant_data_array['billing_zip'] = $billing_zip;
     $merchant_data_array['billing_country'] = $billing_country;
     $merchant_data_array['billing_tel'] = $billing_tel;
     $merchant_data_array['billing_email'] = $billing_email;
     $merchant_data_array['delivery_name'] = $delivery_name;
     $merchant_data_array['delivery_address'] = $delivery_address;
     $merchant_data_array['delivery_city'] = $delivery_city;
     $merchant_data_array['delivery_state'] = $delivery_state;
     $merchant_data_array['delivery_zip'] = $delivery_zip;
     $merchant_data_array['delivery_country'] = $delivery_country;
     $merchant_data_array['delivery_tel'] = $delivery_tel;
     $merchant_data_array['merchant_param1'] = $merchant_param1;
     $merchant_data_array['merchant_param2'] = $merchant_param2;
     $merchant_data_array['merchant_param3'] = $merchant_param3;
     $merchant_data = implode("&", $merchant_data_array);
     $ccavenue_post_data = '';
     $ccavenue_post_data_array = array();
     foreach ($merchant_data_array as $key => $value) {
         $ccavenue_post_data_array[] .= $key . '=' . urlencode($value);
     }
     $ccavenue_post_data = implode("&", $ccavenue_post_data_array);
     $encrypted_data = $this->encrypt($ccavenue_post_data, $encryption_key);
//.........这里部分代码省略.........
开发者ID:ac3gam3r,项目名称:Maxokraft,代码行数:101,代码来源:ccavenue.php

示例9: initContent

 public function initContent()
 {
     // Adding Css
     $this->addCSS(__PS_BASE_URI__ . str_replace(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR, '', _PS_ADMIN_DIR_) . '/themes/' . $this->bo_theme . '/css/modules.css', 'all');
     // If we are on a module configuration, no need to load all modules
     if (Tools::getValue('configure') != '') {
         return true;
     }
     // Init
     $smarty = $this->context->smarty;
     $autocompleteList = 'var moduleList = [';
     $nameCountryDefault = Country::getNameById($this->context->language->id, Configuration::get('PS_COUNTRY_DEFAULT'));
     $categoryFiltered = array();
     $filterCategories = explode('|', Configuration::get('PS_SHOW_CAT_MODULES_' . (int) $this->id_employee));
     if (count($filterCategories) > 0) {
         foreach ($filterCategories as $fc) {
             if (!empty($fc)) {
                 $categoryFiltered[$fc] = 1;
             }
         }
     }
     foreach ($this->list_modules_categories as $k => $v) {
         $this->list_modules_categories[$k]['nb'] = 0;
     }
     // Retrieve Modules Preferences
     $modules_preferences = '';
     $tab_modules_preferences = array();
     $modules_preferences_tmp = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'module_preference` WHERE `id_employee` = ' . (int) $this->id_employee);
     $tab_modules_preferences_tmp = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'tab_module_preference` WHERE `id_employee` = ' . (int) $this->id_employee);
     foreach ($tab_modules_preferences_tmp as $i => $j) {
         $tab_modules_preferences[$j['module']][] = $j['id_tab'];
     }
     foreach ($modules_preferences_tmp as $k => $v) {
         if ($v['interest'] == null) {
             unset($v['interest']);
         }
         if ($v['favorite'] == null) {
             unset($v['favorite']);
         }
         $modules_preferences[$v['module']] = $v;
     }
     // Retrieve Modules List
     $modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
     $this->initModulesList($modules);
     $this->nb_modules_total = count($modules);
     $module_errors = array();
     $module_success = array();
     // Browse modules list
     foreach ($modules as $km => $module) {
         //if we are in favorites view we only display installed modules
         if (Tools::getValue('select') == 'favorites' && !$module->id) {
             unset($modules[$km]);
             continue;
         }
         // Upgrade Module process, init check if a module could be upgraded
         if (Module::initUpgradeModule($module)) {
             // When the XML cache file is up-to-date, the module may not be loaded yet
             if (!class_exists($module->name)) {
                 if (!file_exists(_PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php')) {
                     continue;
                 }
                 require_once _PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php';
             }
             if ($object = new $module->name()) {
                 $object->runUpgradeModule();
                 if (count($errors_module_list = $object->getErrors())) {
                     $module_errors[] = array('name' => $module->name, 'message' => $errors_module_list);
                 } else {
                     if (count($conf_module_list = $object->getConfirmations())) {
                         $module_success[] = array('name' => $module->name, 'message' => $conf_module_list);
                     }
                 }
                 unset($object);
             }
         } elseif (Module::getUpgradeStatus($module->name)) {
             // When the XML cache file is up-to-date, the module may not be loaded yet
             if (!class_exists($module->name)) {
                 if (file_exists(_PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php')) {
                     require_once _PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php';
                     $object = new $module->name();
                     $module_success[] = array('name' => $module->name, 'message' => array(0 => $this->l('Current version:') . $object->version, 1 => $this->l('No file upgrades applied (none exist).')));
                 } else {
                     continue;
                 }
             }
             unset($object);
         }
         // Make modules stats
         $this->makeModulesStats($module);
         // Assign warnings
         if ($module->active && isset($module->warning) && !empty($module->warning)) {
             $this->warnings[] = sprintf($this->l('%1$s: %2$s'), $module->displayName, $module->warning);
         }
         // AutoComplete array
         $autocompleteList .= Tools::jsonEncode(array('displayName' => (string) $module->displayName, 'desc' => (string) $module->description, 'name' => (string) $module->name, 'author' => (string) $module->author, 'image' => isset($module->image) ? (string) $module->image : '', 'option' => '')) . ', ';
         // Apply filter
         if ($this->isModuleFiltered($module) && Tools::getValue('select') != 'favorites') {
             unset($modules[$km]);
         } else {
             $this->fillModuleData($module);
//.........这里部分代码省略.........
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:101,代码来源:AdminModulesController.php

示例10: hookdisplayAdminOrder

 public function hookdisplayAdminOrder()
 {
     $orderId = Tools::getValue('id_order');
     $sql = "SELECT * FROM skrill_order_ref WHERE id_order ='" . $orderId . "'";
     $row = Db::getInstance()->getRow($sql);
     if ($row) {
         if (Tools::isSubmit('skrillUpdateOrder') && $row['order_status'] != $this->refundedStatus) {
             $fieldParams = $this->getSkrillCredentials();
             $fieldParams['type'] = 'mb_trn_id';
             $fieldParams['id'] = $row['ref_id'];
             $paymentResult = '';
             $isPaymentAccepted = SkrillPaymentCore::isPaymentAccepted($fieldParams, $paymentResult);
             if ($isPaymentAccepted) {
                 $responseUpdateOrder = SkrillPaymentCore::getResponseArray($paymentResult);
                 $this->updateTransLogStatus($row['ref_id'], $responseUpdateOrder['status']);
                 $sql = "SELECT * FROM skrill_order_ref WHERE id_order ='" . $orderId . "'";
                 $row = Db::getInstance()->getRow($sql);
             }
         }
         $paymentInfo = array();
         $paymentInfo['name'] = $this->getFrontendPaymentLocale($row['payment_method']);
         $isSkrill = strpos($paymentInfo['name'], 'Skrill');
         if ($isSkrill === false) {
             $paymentInfo['name'] = 'Skrill ' . $paymentInfo['name'];
         }
         $trnStatus = SkrillPaymentCore::getTrnStatus($row['order_status']);
         $paymentInfo['status'] = $this->getTrnStatusLocale($trnStatus);
         $paymentInfo['method'] = $this->getFrontendPaymentLocale('SKRILL_FRONTEND_PM_' . $row['payment_code']);
         $paymentInfo['currency'] = $row['currency'];
         $additionalInformation = $this->getAdditionalInformation($row['add_information']);
         $langId = Context::getContext()->language->id;
         $orderOriginId = $this->getCountryIdByIso($additionalInformation['SKRILL_BACKEND_ORDER_ORIGIN']);
         $paymentInfo['order_origin'] = Country::getNameById($langId, $orderOriginId);
         $getCountryIso2 = SkrillPaymentCore::getCountryIso2($additionalInformation['SKRILL_BACKEND_ORDER_COUNTRY']);
         $orderCountryId = $this->getCountryIdByIso($getCountryIso2);
         $paymentInfo['order_country'] = Country::getNameById($langId, $orderCountryId);
         $buttonUpdateOrder = $row['order_status'] == $this->refundedStatus ? false : true;
         $this->context->smarty->assign(array('orderId' => $orderId, 'paymentInfo' => $paymentInfo, 'buttonUpdateOrder' => $buttonUpdateOrder));
         return $this->display(__FILE__, 'views/templates/hook/displayAdminOrder.tpl');
     }
     return '';
 }
开发者ID:PluginSales,项目名称:Prestashop-Skrill,代码行数:42,代码来源:skrill.php

示例11: hookPayment

 public function hookPayment($params)
 {
     global $cart;
     global $smarty, $cart, $cookie;
     $invoice_address = new Address((int) $cart->id_address_invoice);
     $key = Configuration::get('PAYU_MERCHANT_ID');
     $salt = Configuration::get('PAYU_SALT');
     if (!$this->active) {
         return;
     }
     $mode = Configuration::get('PAYU_MODE');
     $log = Configuration::get('PAYU_LOGS');
     $amount = $cart->getOrderTotal(true, Cart::BOTH);
     $curr_currency = CurrencyCore::getCurrency($cart->id_currency);
     if ($invoice_address->id_country == 110) {
         $key = 'VLBB6Z';
         $salt = 'KQUxLUkT';
         if ($cart->id_currency != 4) {
             //convert to USD(default)
             $amount = Tools::convertPrice($amount, $cart->id_currency, false);
             //convert to INT
             $amount = Tools::convertPrice($amount, 4);
             $inr_currency = CurrencyCore::getCurrency(4);
             $curr_conversion_msg = "<p>Dear Customer, any order with an Indian billing address entails processing of the order value in {$inr_currency['iso_code']} ({$inr_currency['name']}). The order value of <b>" . Tools::displayPrice($amount, 4) . "</b> will be processed.</p><p>Currency conversion rates are provided by  openexchangerates.org</p>";
             $smarty->assign("curr_conversion_msg", $curr_conversion_msg);
         }
     } else {
         if ((int) $curr_currency['paypal_support'] === 1 && $cart->id_currency != 2) {
             //For all Paypal supported curencies except USD, we dont show PayU
             return;
         } else {
             if ($cart->id_currency != 2) {
                 // Currency not supported by Paypal and not USD, convert to USD and proceed
                 $amount = Tools::convertPrice($amount, $cart->id_currency, false);
                 $this_currency = CurrencyCore::getCurrency($cart->id_currency);
                 $curr_conversion_msg = "<p>Unfortunately we are unable to accept payments in <b>{$this_currency['name']}</b>.</p> <p>An equivalent order value of USD <b>" . Tools::displayPrice($amount, 2) . "</b> will be processed.</p>";
                 $smarty->assign("curr_conversion_msg", $curr_conversion_msg);
             }
         }
     }
     $amount = round($amount);
     //else
     //return;
     //convert to INR if the currency is not
     //if ($cart->id_currency != 4)
     //$amount = Tools::convertPrice($amount, 4, true);
     $customer = new Customer((int) $cart->id_customer);
     $action = 'https://test.payu.in/_payment.php';
     $txnid = $cart->id;
     $productInfo = 'Payu product information';
     $firstname = $customer->firstname;
     $Lastname = $customer->lastname;
     $deloveryAddress = new Address((int) $cart->id_address_invoice);
     $Zipcode = $deloveryAddress->postcode;
     $email = $customer->email;
     $phone = $deloveryAddress->phone;
     $deloveryAddress->country = Country::getNameById(1, $deloveryAddress->id_country);
     $deloveryAddress->state = State::getNameById($deloveryAddress->id_state);
     if ($mode == 'real') {
         $action = 'https://secure.payu.in/_payment.php';
     }
     $request = $key . '|' . $txnid . '|' . $amount . '|' . $productInfo . '|' . $firstname . '|' . $email . '|||||||||||' . $salt;
     $Hash = hash('sha512', $key . '|' . $txnid . '|' . $amount . '|' . $productInfo . '|' . $firstname . '|' . $email . '|||||||||||' . $salt);
     $baseUrl = Tools::getShopDomain(true, true) . __PS_BASE_URI__;
     if ($log == 1) {
         $query = "insert into ps_payu_order(id_order,payment_request) values({$orderId},'{$request}')";
         Db::getInstance()->Execute($query);
     }
     $surl = $baseUrl . 'modules/' . $this->name . '/success.php';
     $curl = $baseUrl . 'modules/' . $this->name . '/failure.php';
     $Furl = $baseUrl . 'modules/' . $this->name . '/failure.php';
     $Pg = 'CC';
     $payuInfo = array('action' => $action, 'key' => $key, 'txnid' => $txnid, 'amount' => $amount, 'productinfo' => $productInfo, 'firstname' => $firstname, 'Lastname' => $Lastname, 'Zipcode' => $Zipcode, 'email' => $email, 'phone' => $phone, 'surl' => $surl, 'Furl' => $Furl, 'curl' => $curl, 'Hash' => $Hash, 'Pg' => $Pg, 'deliveryAddress' => $deloveryAddress);
     $smarty->assign('Message', 'Please wait, you will be redirected to payu website');
     $smarty->assign($payuInfo);
     return $this->display(__FILE__, 'payu.tpl');
 }
开发者ID:priyankajsr19,项目名称:shalu,代码行数:77,代码来源:payu.php

示例12: displayList

    public function displayList()
    {
        global $currentIndex, $cookie;
        $modulesAuthors = array();
        $autocompleteList = 'var moduleList = [';
        $showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_' . (int) $cookie->id_employee);
        $showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_' . (int) $cookie->id_employee);
        $showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_' . (int) $cookie->id_employee);
        $showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_' . (int) $cookie->id_employee);
        $nameCountryDefault = Country::getNameById($cookie->id_lang, _PS_COUNTRY_DEFAULT_);
        $isoCountryDefault = Country::getIsoById(_PS_COUNTRY_DEFAULT_);
        $serialModules = '';
        $modules = Module::getModulesOnDisk(true);
        foreach ($modules as $module) {
            if (!in_array($module->name, $this->listNativeModules)) {
                $serialModules .= $module->name . ' ' . $module->version . '-' . ($module->active ? 'a' : 'i') . "\n";
            }
            $moduleAuthor = $module->author;
            if (!empty($moduleAuthor) && $moduleAuthor != "") {
                $modulesAuthors[(string) $moduleAuthor] = true;
            }
        }
        $serialModules = urlencode($serialModules);
        $filterName = Tools::getValue('filtername');
        if (!empty($filterName)) {
            echo '
			<script type="text/javascript">
				$(document).ready(function() {	
					$(\'#all_open\').hide();
					$(\'#all_close\').show();			 
					$(\'.tab_module_content\').each(function(){
						$(this).slideDown();
						$(\'.header_module_img\').each(function(){
							$(this).attr(\'src\', \'../img/admin/less.png\');
						});
					});
				});
			</script>';
        }
        //filter module list
        foreach ($modules as $key => $module) {
            switch ($showTypeModules) {
                case 'nativeModules':
                    if (!in_array($module->name, $this->listNativeModules)) {
                        unset($modules[$key]);
                    }
                    break;
                case 'partnerModules':
                    if (!in_array($module->name, $this->listPartnerModules)) {
                        unset($modules[$key]);
                    }
                    break;
                case 'otherModules':
                    if (in_array($module->name, $this->listPartnerModules) or in_array($module->name, $this->listNativeModules)) {
                        unset($modules[$key]);
                    }
                    break;
                default:
                    if (strpos($showTypeModules, 'authorModules[') !== false) {
                        $author_selected = $this->_getSubmitedModuleAuthor($showTypeModules);
                        $modulesAuthors[$author_selected] = 'selected';
                        // setting selected author in authors set
                        if (empty($module->author) || $module->author != $author_selected) {
                            unset($modules[$key]);
                        }
                    }
                    break;
            }
            switch ($showInstalledModules) {
                case 'installed':
                    if (!$module->id) {
                        unset($modules[$key]);
                    }
                    break;
                case 'unistalled':
                    if ($module->id) {
                        unset($modules[$key]);
                    }
                    break;
            }
            switch ($showEnabledModules) {
                case 'enabled':
                    if (!$module->active) {
                        unset($modules[$key]);
                    }
                    break;
                case 'disabled':
                    if ($module->active) {
                        unset($modules[$key]);
                    }
                    break;
            }
            if ($showCountryModules) {
                if (isset($module->limited_countries) and !empty($module->limited_countries) and (is_array($module->limited_countries) and sizeof($module->limited_countries) and !in_array(strtolower($isoCountryDefault), $module->limited_countries) or !is_array($module->limited_countries) and strtolower($isoCountryDefault) != strval($module->limited_countries))) {
                    unset($modules[$key]);
                }
            }
            if (!empty($filterName)) {
                if (stristr($module->name, $filterName) === false and stristr($module->displayName, $filterName) === false and stristr($module->description, $filterName) === false) {
                    unset($modules[$key]);
//.........这里部分代码省略.........
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:101,代码来源:AdminModules.php

示例13: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if (!$this->errors) {
         if (Pack::isPack((int) $this->product->id) && !Pack::isInStock((int) $this->product->id)) {
             $this->product->quantity = 0;
         }
         $this->product->description = $this->transformDescriptionWithImg($this->product->description);
         // Assign to the template the id of the virtual product. "0" if the product is not downloadable.
         $this->context->smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int) $this->product->id));
         $this->context->smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
         if (Tools::isSubmit('submitCustomizedDatas')) {
             // If cart has not been saved, we need to do it so that customization fields can have an id_cart
             // We check that the cookie exists first to avoid ghost carts
             if (!$this->context->cart->id && isset($_COOKIE[$this->context->cookie->getName()])) {
                 $this->context->cart->add();
                 $this->context->cookie->id_cart = (int) $this->context->cart->id;
             }
             $this->pictureUpload();
             $this->textRecord();
             $this->formTargetFormat();
         } elseif (Tools::getIsset('deletePicture') && !$this->context->cart->deleteCustomizationToProduct($this->product->id, Tools::getValue('deletePicture'))) {
             $this->errors[] = Tools::displayError('An error occurred while deleting the selected picture.');
         }
         $pictures = array();
         $text_fields = array();
         if ($this->product->customizable) {
             $files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true);
             foreach ($files as $file) {
                 $pictures['pictures_' . $this->product->id . '_' . $file['index']] = $file['value'];
             }
             $texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true);
             foreach ($texts as $text_field) {
                 $text_fields['textFields_' . $this->product->id . '_' . $text_field['index']] = str_replace('<br />', "\n", $text_field['value']);
             }
         }
         $this->context->smarty->assign(array('pictures' => $pictures, 'textFields' => $text_fields));
         $this->product->customization_required = false;
         $customization_fields = $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false;
         if (is_array($customization_fields)) {
             foreach ($customization_fields as $customization_field) {
                 if ($this->product->customization_required = $customization_field['required']) {
                     break;
                 }
             }
         }
         // Assign template vars related to the category + execute hooks related to the category
         $this->assignCategory();
         // Assign template vars related to the price and tax
         $this->assignPriceAndTax();
         // Assign template vars related to the images
         $this->assignImages();
         // Assign attribute groups to the template
         $this->assignAttributesGroups();
         // Assign attributes combinations to the template
         $this->assignAttributesCombinations();
         // Pack management
         $pack_items = Pack::isPack($this->product->id) ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array();
         $this->context->smarty->assign('packItems', $pack_items);
         $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1));
         if (isset($this->category->id) && $this->category->id) {
             $return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category));
         } else {
             $return_link = 'javascript: history.back();';
         }
         $accessories = $this->product->getAccessories($this->context->language->id);
         if ($this->product->cache_is_pack || count($accessories)) {
             $this->context->controller->addCSS(_THEME_CSS_DIR_ . 'product_list.css');
         }
         if ($this->product->customizable) {
             $customization_datas = $this->context->cart->getProductCustomization($this->product->id, null, true);
         }
         // by webkul
         $htl_features = array();
         $obj_hotel_room_type = new HotelRoomType();
         $room_info_by_product_id = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($this->product->id);
         $hotel_id = $room_info_by_product_id['id_hotel'];
         if (isset($hotel_id) && $hotel_id) {
             $obj_hotel_branch = new HotelBranchInformation();
             $hotel_info_by_id = $obj_hotel_branch->hotelBranchInfoById($hotel_id);
             $hotel_policies = $hotel_info_by_id['policies'];
             $hotel_name = $hotel_info_by_id['hotel_name'];
             $country = Country::getNameById($this->context->language->id, $hotel_info_by_id['country_id']);
             $state = State::getNameById($hotel_info_by_id['state_id']);
             $hotel_location = $hotel_info_by_id['city'] . ', ' . $state . ', ' . $country;
             $obj_hotel_feaures_ids = $obj_hotel_branch->getFeaturesOfHotelByHotelId($hotel_id);
             if (isset($obj_hotel_feaures_ids) && $obj_hotel_feaures_ids) {
                 foreach ($obj_hotel_feaures_ids as $key => $value) {
                     $obj_htl_ftr = new HotelFeatures();
                     $htl_info = $obj_htl_ftr->getFeatureInfoById($value['feature_id']);
                     $htl_features[] = $htl_info['name'];
                 }
             }
         }
         $date_from = Tools::getValue('date_from');
         $date_to = Tools::getValue('date_to');
//.........这里部分代码省略.........
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:101,代码来源:ProductController.php

示例14: setDelivery

 private function setDelivery()
 {
     $product_price = $this->give_it_product->data['details']['price'];
     // add a delivery option
     $delivery = new GiveItSdkOption(array('id' => 'my_id', 'type' => 'layered_delivery', 'name' => 'Shipping', 'tax_delivery' => true));
     // loop through all countries for which shipping is defined and create a choice on this option
     $this->getShippingRules();
     $zones = Zone::getZones(false);
     foreach (self::$shipping_rules as $rule) {
         if (is_numeric($rule['iso_code'])) {
             // it's a zone not a country
             foreach ($zones as $zone) {
                 if ($zone['id_zone'] == $rule['iso_code']) {
                     $country_name = $zone['name'];
                 }
             }
         } else {
             $country_id = Country::getByIso($rule['iso_code']);
             $country_name = Country::getNameById(Configuration::get('PS_LANG_DEFAULT'), $country_id);
         }
         $choice = new GiveItSdkChoice(array('id' => $rule['iso_code'], 'name' => $country_name, 'choices_title' => $country_name));
         // look for options for this country
         foreach (self::$shipping_rules as $option) {
             if ($option['iso_code'] == $rule['iso_code']) {
                 // if option has free_above and price > then display 0 price
                 $option_price = $option['price'];
                 if ($option['free_above'] > 0 && $product_price > $option['free_above']) {
                     $option_price = 0;
                 }
                 $choice->addChoice(new GiveItSdkChoice(array('id' => $option['id'], 'name' => $option['name'], 'price' => $option_price, 'tax_percent' => (int) $option['tax_percent'])));
             }
         }
         $delivery->addChoice($choice);
     }
     return $delivery;
 }
开发者ID:TheTypoMaster,项目名称:neotienda,代码行数:36,代码来源:giveit.class.php

示例15: postProcess

 public function postProcess()
 {
     // On construit un login pour le compte
     // ------------------------------------
     // Si PS_SHOP_EMAIL = info@axalone.com
     // Alors login      = ps-info-axalone
     //   1/ On ajoute 'ps-' devant l'email
     //   2/ On retire l'extention .com à la fin
     //   3/ On remplace toutes les lettres accentuées par leurs équivalents sans accent
     //   4/ On remplace tous les sigles par des tirets
     //   5/ Enfin on remplace les doubles/triples tirets par des simples
     // --------------------------------------------------------------------------------
     $company_login = 'ps-' . Configuration::get('PS_SHOP_EMAIL');
     $company_login = Tools::substr($company_login, 0, strrpos($company_login, '.'));
     $company_login = EMTools::removeAccents($company_login);
     $company_login = Tools::strtolower($company_login);
     $company_login = preg_replace('/[^a-z0-9-]/', '-', $company_login);
     $company_login = preg_replace('/-{2,}/', '-', $company_login);
     $cart_product = (string) Tools::getValue('product', '');
     // Initialisation de l'API
     // -----------------------
     if (Tools::isSubmit('submitInscription')) {
         // On prépare l'ouverture du compte
         // --------------------------------
         $company_name = (string) Tools::getValue('company_name');
         $company_email = (string) Tools::getValue('company_email');
         $company_phone = (string) Tools::getValue('company_phone');
         $company_address1 = (string) Tools::getValue('company_address1');
         $company_address2 = (string) Tools::getValue('company_address2');
         $company_zipcode = (string) Tools::getValue('company_zipcode');
         $company_city = (string) Tools::getValue('company_city');
         $country_id = (int) Tools::getValue('country_id');
         $country = new Country($country_id);
         if (!is_object($country) || empty($country->id)) {
             $this->errors[] = Tools::displayError('Country is invalid');
         } else {
             $company_country = Country::getNameById($this->context->language->id, $country_id);
         }
         if (!Validate::isGenericName($company_name)) {
             $this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('Shop name', 'AdminStores') . ' »');
         }
         if (!Validate::isEmail($company_email)) {
             $this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('Shop email', 'AdminStores') . ' »');
         }
         if (!Validate::isPhoneNumber($company_phone)) {
             $this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('Phone', 'AdminStores') . ' »');
         }
         if (!Validate::isAddress($company_address1)) {
             $this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('Shop address line 1', 'AdminStores') . ' »');
         }
         if ($country->zip_code_format && !$country->checkZipCode($company_zipcode)) {
             $this->errors[] = Tools::displayError('Your Zip/postal code is incorrect.') . '<br />' . Tools::displayError('It must be entered as follows:') . ' ' . str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)));
         } elseif (empty($company_zipcode) && $country->need_zip_code) {
             $this->errors[] = Tools::displayError('A Zip/postal code is required.');
         } elseif ($company_zipcode && !Validate::isPostCode($company_zipcode)) {
             $this->errors[] = Tools::displayError('The Zip/postal code is invalid.');
         }
         if (!Validate::isGenericName($company_city)) {
             $this->errors[] = sprintf(Tools::displayError('The %s field is required.'), '« ' . Translate::getAdminTranslation('City', 'AdminStores') . ' »');
         }
         // We save these informations in the database
         // ------------------------------------------
         Db::getInstance()->insert('expressmailing_order_address', array('id_address' => 1, 'company_name' => pSQL($company_name), 'company_email' => pSQL($company_email), 'company_address1' => pSQL($company_address1), 'company_address2' => pSQL($company_address2), 'company_zipcode' => pSQL($company_zipcode), 'company_city' => pSQL($company_city), 'country_id' => $country_id, 'company_country' => pSQL($company_country), 'company_phone' => pSQL($company_phone), 'product' => pSQL($cart_product)), false, false, Db::REPLACE);
         // If form contains 1 or more errors, we stop the process
         // ------------------------------------------------------
         if (is_array($this->errors) && count($this->errors)) {
             return false;
         }
         // Open a session on Express-Mailing API
         // -------------------------------------
         if ($this->session_api->openSession()) {
             // We create the account
             // ---------------------
             $response_array = array();
             $base_url = Configuration::get('PS_SSL_ENABLED') == 0 ? Tools::getShopDomain(true, true) : Tools::getShopDomainSsl(true, true);
             $module_dir = Tools::str_replace_once(_PS_ROOT_DIR_, '', _PS_MODULE_DIR_);
             $parameters = array('login' => $company_login, 'info_company' => $company_name, 'info_email' => $company_email, 'info_phone' => $company_phone, 'info_address' => $company_address1 . "\r\n" . $company_address2, 'info_country' => $company_country, 'info_zipcode' => $company_zipcode, 'info_city' => $company_city, 'info_phone' => $company_phone, 'info_contact_firstname' => $this->context->employee->firstname, 'info_contact_lastname' => $this->context->employee->lastname, 'email_report' => $this->context->employee->email, 'gift_code' => 'prestashop_' . Translate::getModuleTranslation('expressmailing', '3320', 'session_api'), 'INFO_WWW' => $base_url . $module_dir . $this->module->name . '/campaigns/index.php');
             if ($this->session_api->createAccount($parameters, $response_array)) {
                 // If the form include the buying process (field 'product')
                 // We initiate a new cart with the product selected
                 // --------------------------------------------------------
                 if ($cart_product) {
                     Tools::redirectAdmin('index.php?controller=AdminMarketingBuy&submitCheckout&campaign_id=' . $this->campaign_id . '&media=' . $this->next_controller . '&product=' . $cart_product . '&token=' . Tools::getAdminTokenLite('AdminMarketingBuy'));
                     exit;
                 }
                 // Else we back to the mailing process
                 // -----------------------------------
                 Tools::redirectAdmin($this->next_action);
                 exit;
             }
             if ($this->session_api->error == 11) {
                 // Account already existe, we print the rescue form (with password input)
                 // ----------------------------------------------------------------------
                 $response_array = array();
                 $parameters = array('login' => $company_login);
                 $this->session_api->resendPassword($parameters, $response_array);
                 $this->generateRescueForm();
                 return;
             } else {
                 // Other error
//.........这里部分代码省略.........
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:101,代码来源:adminmarketinginscription.php


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