/**
  * @param int|bool $storeId
  * @param string $countryCode
  * @return int
  */
 public function updateStoreId($storeId, $countryCode)
 {
     if (!$this->generalConfig->isMappingSore()) {
         return $storeId;
     }
     $countryStoreCode = strtolower($countryCode);
     if (in_array($countryStoreCode, $this->getWebsite($storeId)->getStoreCodes())) {
         $storeId = $this->storeRepository->get($countryStoreCode)->getId();
     }
     return $storeId;
 }
 /**
  * {@inheritdoc}
  */
 public function getStore($storeId = null)
 {
     if (!isset($storeId) || '' === $storeId || $storeId === true) {
         if (!$this->currentStoreId) {
             \Magento\Framework\Profiler::start('store.resolve');
             $this->currentStoreId = $this->storeResolver->getCurrentStoreId();
             \Magento\Framework\Profiler::stop('store.resolve');
         }
         $storeId = $this->currentStoreId;
     }
     if ($storeId instanceof \Magento\Store\Api\Data\StoreInterface) {
         return $storeId;
     }
     $store = is_numeric($storeId) ? $this->storeRepository->getById($storeId) : $this->storeRepository->get($storeId);
     return $store;
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function getDefaultStoreId($scopeCode)
 {
     return $this->storeRepository->get($scopeCode)->getId();
 }