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


PHP PaymentModule::addCurrencyPermissions方法代码示例

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


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

示例1: _installCurrencies

 /**
  * @param SimpleXMLElement $xml
  * @param bool $install_mode
  * @return bool
  * @throws PrestaShopException
  */
 protected function _installCurrencies($xml, $install_mode = false)
 {
     if (isset($xml->currencies->currency)) {
         foreach ($xml->currencies->currency as $data) {
             /** @var SimpleXMLElement $data */
             $attributes = $data->attributes();
             if (Currency::exists($attributes['iso_code'], (int) $attributes['iso_code_num'])) {
                 continue;
             }
             $currency = new Currency();
             $currency->name = (string) $attributes['name'];
             $currency->iso_code = (string) $attributes['iso_code'];
             $currency->iso_code_num = (int) $attributes['iso_code_num'];
             $currency->sign = (string) $attributes['sign'];
             $currency->blank = (int) $attributes['blank'];
             $currency->conversion_rate = 1;
             // This value will be updated if the store is online
             $currency->format = (int) $attributes['format'];
             $currency->decimals = (int) $attributes['decimals'];
             $currency->active = true;
             if (!$currency->validateFields()) {
                 $this->_errors[] = Tools::displayError('Invalid currency properties.');
                 return false;
             }
             if (!Currency::exists($currency->iso_code, $currency->iso_code_num)) {
                 if (!$currency->add()) {
                     $this->_errors[] = Tools::displayError('An error occurred while importing the currency: ') . strval($attributes['name']);
                     return false;
                 }
                 PaymentModule::addCurrencyPermissions($currency->id);
             }
         }
         if (($error = Currency::refreshCurrencies()) !== null) {
             $this->_errors[] = $error;
         }
         if (!count($this->_errors) && $install_mode && isset($attributes['iso_code']) && count($xml->currencies->currency) == 1) {
             $this->iso_currency = $attributes['iso_code'];
         }
     }
     return true;
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:47,代码来源:LocalizationPack.php

示例2: _installCurrencies

 protected function _installCurrencies($xml, $install_mode = false)
 {
     if (isset($xml->currencies->currency)) {
         if (!($feed = Tools::simplexml_load_file('http://www.prestashop.com/xml/currencies.xml')) and !($feed = @simplexml_load_file(dirname(__FILE__) . '/../localization/currencies.xml'))) {
             $this->_errors[] = Tools::displayError('Cannot parse the currencies XML feed.');
             return false;
         }
         foreach ($xml->currencies->currency as $data) {
             $attributes = $data->attributes();
             if (Currency::exists($attributes['iso_code'])) {
                 continue;
             }
             $currency = new Currency();
             $currency->name = strval($attributes['name']);
             $currency->iso_code = strval($attributes['iso_code']);
             $currency->iso_code_num = (int) $attributes['iso_code_num'];
             $currency->sign = strval($attributes['sign']);
             $currency->blank = (int) $attributes['blank'];
             $currency->conversion_rate = 1;
             // This value will be updated if the store is online
             $currency->format = (int) $attributes['format'];
             $currency->decimals = (int) $attributes['decimals'];
             $currency->active = $install_mode;
             if (!$currency->validateFields()) {
                 $this->_errors[] = Tools::displayError('Invalid currency properties.');
                 return false;
             }
             if (!Currency::exists($currency->iso_code)) {
                 if (!$currency->add()) {
                     $this->_errors[] = Tools::displayError('An error occurred while importing the currency: ') . strval($attributes['name']);
                     return false;
                 }
                 PaymentModule::addCurrencyPermissions($currency->id);
             }
         }
         Currency::refreshCurrencies();
         if (!sizeof($this->_errors) and $install_mode and isset($attributes['iso_code']) and sizeof($xml->currencies->currency) == 1) {
             $this->iso_currency = $attributes['iso_code'];
         }
     }
     return true;
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:42,代码来源:LocalizationPack.php


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