本文整理汇总了PHP中Currency::getIdByIsoCodeNum方法的典型用法代码示例。如果您正苦于以下问题:PHP Currency::getIdByIsoCodeNum方法的具体用法?PHP Currency::getIdByIsoCodeNum怎么用?PHP Currency::getIdByIsoCodeNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Currency
的用法示例。
在下文中一共展示了Currency::getIdByIsoCodeNum方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exists
/**
* Check if a curency already exists.
*
* @param int|string $iso_code int for iso code number string for iso code
* @return boolean
*/
public static function exists($iso_code)
{
if (is_int($iso_code)) {
$id_currency_exists = Currency::getIdByIsoCodeNum($iso_code);
} else {
$id_currency_exists = Currency::getIdByIsoCode($iso_code);
}
if ($id_currency_exists) {
return true;
} else {
return false;
}
}
示例2: genericImportWS
public function genericImportWS($className, $fields, $save = false)
{
$return = '';
$json = array();
$errors = array();
$json['hasError'] = false;
$json['datas'] = array_values($fields);
$languages = array();
$defaultLanguage = '';
$table = $this->supportedImports[strtolower($className)]['table'];
$object = new $className();
$rules = call_user_func(array($className, 'getValidationRules'), $className);
if (sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang']) || Tools::isSubmit('syncLangWS') || Tools::isSubmit('syncCurrency')) {
$moduleName = Tools::getValue('moduleName');
if (Validate::isModuleName($moduleName) && file_exists('../../modules/' . $moduleName . '/' . $moduleName . '.php')) {
require_once '../../modules/' . $moduleName . '/' . $moduleName . '.php';
$importModule = new $moduleName();
$defaultLanguage = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
$languages = $importModule->getLangagues();
if (Tools::isSubmit('syncLangWS')) {
$defaultIdLand = $importModule->getDefaultIdLang();
$defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code']));
if ($defaultLanguage->iso_code != $defaultLanguageImport->iso_code) {
$errors[] = $this->l('Default language doesn\'t match : ') . '<br>' . Configuration::get('PS_SHOP_NAME') . ' : ' . $defaultLanguage->name . ' ≠
' . $importModule->displayName . ' : ' . $defaultLanguageImport->name . '<br>' . $this->l('Please change default language in your configuration');
}
}
if (Tools::isSubmit('syncCurrency')) {
$defaultIdCurrency = $importModule->getDefaultIdCurrency();
$currencies = $importModule->getCurrencies();
if (!empty($currencies[$defaultIdCurrency]['iso_code'])) {
$defaultCurrencyImport = new Currency((int) Currency::getIdByIsoCode($currencies[$defaultIdCurrency]['iso_code']));
} else {
$defaultCurrencyImport = new Currency((int) Currency::getIdByIsoCodeNum($currencies[$defaultIdCurrency]['iso_code_num']));
}
$defaultCurrency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
if ($defaultCurrency->iso_code != $defaultCurrencyImport->iso_code) {
$errors[] = $this->l('Default currency doesn\'t match : ') . '<br>' . Configuration::get('PS_SHOP_NAME') . ' : ' . $defaultCurrency->name . ' ≠ ' . $importModule->displayName . ' : ' . $defaultCurrencyImport->name . '<br>' . $this->l('Please change default currency in your configuration');
}
}
if (!empty($errors)) {
die('{"hasError" : true, "error" : ' . Tools::jsonEncode($errors) . '}');
}
} else {
die('{"hasError" : true, "error" : ["FATAL ERROR"], "datas" : []}');
}
}
foreach ($fields as $key => $field) {
$id = $this->supportedImports[strtolower($className)]['identifier'];
//remove wrong fields (ex : id_toto in Customer)
foreach ($field as $name => $value) {
if (!array_key_exists($name, get_object_vars($object)) and $name != $id and $name != 'association' and $name != 'images' and strtolower($className) != 'cart') {
unset($field[$name]);
}
}
$return = $this->validateRules($rules, $field, $className, $languages, $defaultLanguage);
$fields[$key] = $field;
if (!empty($return)) {
//skip mode
if (Tools::getValue('hasErrors') == 1) {
unset($fields[$key]);
}
$errors[] = $return;
array_unshift($errors[sizeof($errors) - 1], $field[$id]);
}
}
if (sizeof($errors) > 0) {
$json['hasError'] = true;
$json['error'] = $errors;
}
if ($save || Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) {
//add language if not exist in prestashop
if ($className == 'Language') {
if (Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) {
$add = true;
} else {
$add = false;
}
$errors = $this->checkAndAddLang($fields, $add);
} elseif ($className == 'Cart') {
$this->saveOrders($fields);
} else {
$return = $this->saveObject($className, $fields);
$this->cleanPositions($table);
//insert association
if (array_key_exists('association', $this->supportedImports[strtolower($className)])) {
$this->insertAssociation(strtolower($className), $fields);
}
if (!empty($return)) {
$json['hasError'] = true;
$json['error'] = $return;
}
}
if ($className == 'Category' and sizeof($fields) != (int) Tools::getValue('nbr_import')) {
$this->updateCat();
}
}
if (sizeof($errors) > 0 and is_array($errors)) {
$json['hasError'] = true;
$json['error'] = $errors;
//.........这里部分代码省略.........
示例3: exists
/**
* Check if a curency already exists.
*
* @param int|string $iso_code int for iso code number string for iso code
* @return boolean
*/
public static function exists($iso_code, $iso_code_num, $id_shop = 0)
{
if (is_int($iso_code)) {
$id_currency_exists = Currency::getIdByIsoCodeNum((int) $iso_code_num, (int) $id_shop);
} else {
$id_currency_exists = Currency::getIdByIsoCode($iso_code, (int) $id_shop);
}
if ($id_currency_exists) {
return true;
} else {
return false;
}
}
示例4: exists
/**
* Check if a curency already exists.
*
* @param int|string $iso_code int for iso code number string for iso code
* @return boolean
*/
public static function exists($iso_code)
{
return (bool) (is_int($iso_code) ? Currency::getIdByIsoCodeNum((int) $iso_code) : Currency::getIdByIsoCode($iso_code));
}
示例5: saveOrder
/**
* Save order and transaction info.
*/
public function saveOrder($cart, $orderStatus, $payzenResponse)
{
$this->logger->logInfo("Create order for cart #{$cart->id}.");
// Retrieve customer from cart
$customer = new Customer($cart->id_customer);
// ps id_currency from currency iso num code
$currencyId = Currency::getIdByIsoCodeNum((int) $payzenResponse->get('currency'));
// 3ds extra message
$msg3ds = "\n" . $this->l('3DS authentication : ');
if ($payzenResponse->get('threeds_status') == 'Y') {
$msg3ds .= $this->l('YES');
$msg3ds .= "\n" . $this->l('3DS certificate : ') . $payzenResponse->get('threeds_cavv');
} else {
$msg3ds .= $this->l('NO');
}
// call payment module validateOrder
$this->validateOrder($cart->id, $orderStatus, $payzenResponse->getFloatAmount(), $payzenResponse->get('order_info'), $payzenResponse->getLogString() . $msg3ds, array(), $currencyId, false, $customer->secure_key);
// reload order
$order = new Order((int) Order::getOrderByCartId($cart->id));
$this->logger->logInfo("Order #{$order->id} created successfully for cart #{$cart->id}.");
$this->savePayment($order, $payzenResponse);
return $order;
}