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


PHP Data::getBaseCurrencyCode方法代码示例

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


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

示例1: afterLoad

 /**
  * Assign WEEE taxes to product data
  *
  * @param   \Magento\Catalog\Model\Product $object
  * @return  $this
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function afterLoad($object)
 {
     $data = $this->_attributeTax->loadProductData($object, $this->getAttribute());
     foreach ($data as $i => $row) {
         if ($data[$i]['website_id'] == 0) {
             $rate = $this->_storeManager->getStore()->getBaseCurrency()->getRate($this->_directoryHelper->getBaseCurrencyCode());
             if ($rate) {
                 $data[$i]['website_value'] = $data[$i]['value'] / $rate;
             } else {
                 unset($data[$i]);
             }
         } else {
             $data[$i]['website_value'] = $data[$i]['value'];
         }
     }
     $object->setData($this->getAttribute()->getName(), $data);
     return $this;
 }
开发者ID:nja78,项目名称:magento2,代码行数:25,代码来源:Tax.php

示例2: getConfigAllowCurrencies

 /**
  * Retrieve allowed currencies according to config
  *
  * @return array
  */
 public function getConfigAllowCurrencies()
 {
     $allowedCurrencies = $this->_getResource()->getConfigCurrencies($this, self::XML_PATH_CURRENCY_ALLOW);
     $appBaseCurrencyCode = $this->_directoryHelper->getBaseCurrencyCode();
     if (!in_array($appBaseCurrencyCode, $allowedCurrencies)) {
         $allowedCurrencies[] = $appBaseCurrencyCode;
     }
     foreach ($this->_storeManager->getStores() as $store) {
         $code = $store->getBaseCurrencyCode();
         if (!in_array($code, $allowedCurrencies)) {
             $allowedCurrencies[] = $code;
         }
     }
     return $allowedCurrencies;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:20,代码来源:Currency.php

示例3: getWebsites

 /**
  * Get websites list
  *
  * @return array
  */
 protected function getWebsites()
 {
     $websites = [['label' => __('All Websites') . ' [' . $this->directoryHelper->getBaseCurrencyCode() . ']', 'value' => 0]];
     $product = $this->locator->getProduct();
     if (!$this->isScopeGlobal() && $product->getStoreId()) {
         /** @var \Magento\Store\Model\Website $website */
         $website = $this->getStore()->getWebsite();
         $websites[] = ['label' => $website->getName() . '[' . $website->getBaseCurrencyCode() . ']', 'value' => $website->getId()];
     } elseif (!$this->isScopeGlobal()) {
         $websitesList = $this->storeManager->getWebsites();
         $productWebsiteIds = $product->getWebsiteIds();
         foreach ($websitesList as $website) {
             /** @var \Magento\Store\Model\Website $website */
             if (!in_array($website->getId(), $productWebsiteIds)) {
                 continue;
             }
             $websites[] = ['label' => $website->getName() . '[' . $website->getBaseCurrencyCode() . ']', 'value' => $website->getId()];
         }
     }
     return $websites;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:26,代码来源:AdvancedPricing.php

示例4: getWebsites

 /**
  * @return array|null
  */
 public function getWebsites()
 {
     if (null !== $this->_websites) {
         return $this->_websites;
     }
     $websites = [];
     $websites[0] = ['name' => __('All Websites'), 'currency' => $this->_directoryHelper->getBaseCurrencyCode()];
     if (!$this->_storeManager->hasSingleStore() && !$this->getElement()->getEntityAttribute()->isScopeGlobal()) {
         if ($storeId = $this->getProduct()->getStoreId()) {
             $website = $this->_storeManager->getStore($storeId)->getWebsite();
             $websites[$website->getId()] = ['name' => $website->getName(), 'currency' => $website->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE)];
         } else {
             foreach ($this->_storeManager->getWebsites() as $website) {
                 if (!in_array($website->getId(), $this->getProduct()->getWebsiteIds())) {
                     continue;
                 }
                 $websites[$website->getId()] = ['name' => $website->getName(), 'currency' => $website->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE)];
             }
         }
     }
     $this->_websites = $websites;
     return $this->_websites;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:26,代码来源:Tax.php

示例5: getWebsites

 /**
  * Retrieve allowed for edit websites
  *
  * @return array
  */
 public function getWebsites()
 {
     if ($this->_websites !== null) {
         return $this->_websites;
     }
     $this->_websites = [0 => ['name' => __('All Websites'), 'currency' => $this->_directoryHelper->getBaseCurrencyCode()]];
     if (!$this->isScopeGlobal() && $this->getProduct()->getStoreId()) {
         /** @var $website \Magento\Store\Model\Website */
         $website = $this->_storeManager->getStore($this->getProduct()->getStoreId())->getWebsite();
         $this->_websites[$website->getId()] = ['name' => $website->getName(), 'currency' => $website->getBaseCurrencyCode()];
     } elseif (!$this->isScopeGlobal()) {
         $websites = $this->_storeManager->getWebsites(false);
         $productWebsiteIds = $this->getProduct()->getWebsiteIds();
         foreach ($websites as $website) {
             /** @var $website \Magento\Store\Model\Website */
             if (!in_array($website->getId(), $productWebsiteIds)) {
                 continue;
             }
             $this->_websites[$website->getId()] = ['name' => $website->getName(), 'currency' => $website->getBaseCurrencyCode()];
         }
     }
     return $this->_websites;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:28,代码来源:AbstractGroup.php


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