public function getCurrentStockId()
 {
     $group = $this->_manStore->getGroup();
     $id = $group->getId();
     $result = isset($this->_mapGroupToStock[$id]) ? $this->_mapGroupToStock[$id] : \Magento\CatalogInventory\Model\Stock::DEFAULT_STOCK_ID;
     return $result;
 }
Example #2
0
 /**
  * {@inheritdoc}
  * @throws InitException
  */
 public function getScope($scopeId = null)
 {
     $scope = $this->storeManager->getGroup($scopeId);
     if (!$scope instanceof ScopeInterface) {
         throw new InitException(__('Invalid scope object'));
     }
     return $scope;
 }
Example #3
0
 /**
  * Retrieve store root category id.
  *
  * @param \Magento\Store\Api\Data\StoreInterface|int|string $store Store id.
  *
  * @return integer
  */
 protected function getRootCategoryId($store)
 {
     if (is_numeric($store) || is_string($store)) {
         $store = $this->getStore($store);
     }
     $storeGroupId = $store->getStoreGroupId();
     return $this->storeManager->getGroup($storeGroupId)->getRootCategoryId();
 }
Example #4
0
 /**
  * @return array
  */
 protected function getDefaultCustomerProfile()
 {
     if (!$this->customerDataProfile) {
         $this->customerDataProfile = ['website_id' => $this->storeManager->getWebsite()->getId(), 'group_id' => $this->storeManager->getGroup()->getId(), 'disable_auto_group_change' => '0', 'prefix', 'firstname' => '', 'middlename' => '', 'lastname' => '', 'suffix' => '', 'email' => '', 'dob' => '', 'taxvat' => '', 'gender' => '', 'confirmation' => false, 'sendemail' => false];
     }
     return $this->customerDataProfile;
 }
 /**
  * @return void
  */
 protected function _initCollection()
 {
     $isFilter = $this->getParam('store') || $this->getParam('website') || $this->getParam('group');
     $this->_collection = $this->_orderCollection->prepareSummary($this->getParam('period'), 0, 0, $isFilter);
     if ($this->getParam('store')) {
         $this->_collection->addFieldToFilter('store_id', $this->getParam('store'));
     } elseif ($this->getParam('website')) {
         $storeIds = $this->_storeManager->getWebsite($this->getParam('website'))->getStoreIds();
         $this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]);
     } elseif ($this->getParam('group')) {
         $storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds();
         $this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]);
     } elseif (!$this->_collection->isLive()) {
         $this->_collection->addFieldToFilter('store_id', ['eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()]);
     }
     $this->_collection->load();
 }
 /**
  * Retrieve default currency for selected store, website or website group
  * @todo: Refactor to ScopeDefiner
  * @param \Magento\Framework\App\RequestInterface $request
  * @return string
  */
 public function getDefaultCurrency(\Magento\Framework\App\RequestInterface $request)
 {
     if ($request->getParam('store')) {
         $store = $request->getParam('store');
         $currencyCode = $this->_storeManager->getStore($store)->getBaseCurrencyCode();
     } else {
         if ($request->getParam('website')) {
             $website = $request->getParam('website');
             $currencyCode = $this->_storeManager->getWebsite($website)->getBaseCurrencyCode();
         } else {
             if ($request->getParam('group')) {
                 $group = $request->getParam('group');
                 $currencyCode = $this->_storeManager->getGroup($group)->getWebsite()->getBaseCurrencyCode();
             } else {
                 $currencyCode = $this->_configuration->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default');
             }
         }
     }
     return $currencyCode;
 }
 /**
  * @inheritdoc
  */
 public function getFallbackScope($scope, $scopeId, $forConfig = true)
 {
     if (!isset($this->fallback[$scope][$scopeId][$forConfig])) {
         $fallback = [null, null];
         switch ($scope) {
             case ScopeInterface::SCOPE_WEBSITE:
             case ScopeInterface::SCOPE_WEBSITES:
                 $fallback = [ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null];
                 break;
             case ScopeInterface::SCOPE_GROUP:
                 $fallback = [ScopeInterface::SCOPE_WEBSITES, $this->storeManager->getGroup($scopeId)->getWebsiteId()];
                 break;
             case ScopeInterface::SCOPE_STORE:
             case ScopeInterface::SCOPE_STORES:
                 $fallback = $forConfig ? [ScopeInterface::SCOPE_WEBSITES, $this->storeManager->getStore($scopeId)->getWebsiteId()] : [ScopeInterface::SCOPE_GROUP, $this->storeManager->getStore($scopeId)->getStoreGroupId()];
         }
         $this->fallback[$scope][$scopeId][$forConfig] = $fallback;
     }
     return $this->fallback[$scope][$scopeId][$forConfig];
 }