Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Shopcart.php
Go to the documentation of this file.
1 <?php
7 
13 class Shopcart extends \Magento\Backend\Block\Widget\Grid\Extended
14 {
20  protected $_currentCurrencyCode = null;
21 
27  protected $_storeIds = [];
28 
36  public function setStoreIds($storeIds)
37  {
38  $this->_storeIds = $storeIds;
39  return $this;
40  }
41 
47  public function getCurrentCurrencyCode()
48  {
49  if ($this->_currentCurrencyCode === null) {
50  reset($this->_storeIds);
51  $this->_currentCurrencyCode = count(
52  $this->_storeIds
53  ) > 0 ? $this->_storeManager->getStore(
54  current($this->_storeIds)
55  )->getBaseCurrencyCode() : $this->_storeManager->getStore()->getBaseCurrencyCode();
56  }
58  }
59 
66  public function getRate($toCurrency)
67  {
68  return $this->_storeManager->getStore()->getBaseCurrency()->getRate($toCurrency);
69  }
70 }