當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。