121 $this->currentStoreId =
$store;
129 $this->isSingleStoreAllowed =
$value;
138 return $this->isSingleStoreAllowed && count($this->
getStores(
true)) < 3;
155 if (
null === $this->currentStoreId) {
156 \Magento\Framework\Profiler::start(
'store.resolve');
157 $this->currentStoreId = $this->storeResolver->getCurrentStoreId();
158 \Magento\Framework\Profiler::stop(
'store.resolve');
167 ? $this->storeRepository->getById(
$storeId)
168 : $this->storeRepository->get(
$storeId);
176 public function getStores($withDefault =
false, $codeKey =
false)
179 foreach ($this->storeRepository->getList() as
$store) {
180 if (!$withDefault &&
$store->getId() == 0) {
198 $website = $this->websiteRepository->getById($this->
getStore()->getWebsiteId());
202 $website = $this->websiteRepository->getDefault();
215 public function getWebsites($withDefault =
false, $codeKey =
false)
218 foreach ($this->websiteRepository->getList() as
$website) {
219 if (!$withDefault &&
$website->getId() == 0) {
236 $this->currentStoreId =
null;
238 $this->scopeConfig->clean();
239 $this->storeRepository->clean();
240 $this->websiteRepository->clean();
241 $this->groupRepository->clean();
249 $defaultWebsite = $this->websiteRepository->getDefault();
250 $defaultStore = $this->
getGroup($defaultWebsite->getDefaultGroupId())->getDefaultStore();
251 return $defaultStore ?:
null;
260 $group = $this->groupRepository->get($this->
getStore()->getGroupId());
274 $groups = $this->groupRepository->getList();
276 return $withDefault ? $groups : array_filter(
279 return $item->getId() != 0;
294 return (
bool)$this->scopeConfig->getValue(
295 self::XML_PATH_SINGLE_STORE_MODE_ENABLED,
304 private function getStoreWebsiteRelation()
314 return $this->getStoreWebsiteRelation()->getStoreByWebsiteId(
$websiteId);
elseif(isset( $params[ 'redirect_parent']))
__construct(\Magento\Store\Api\StoreRepositoryInterface $storeRepository, \Magento\Store\Api\GroupRepositoryInterface $groupRepository, \Magento\Store\Api\WebsiteRepositoryInterface $websiteRepository, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, StoreResolverInterface $storeResolver, \Magento\Framework\Cache\FrontendInterface $cache, $isSingleStoreAllowed=true)
getGroups($withDefault=false)
setIsSingleStoreModeAllowed($value)
getStoreByWebsiteId($websiteId)
getWebsite($websiteId=null)
isSingleStoreModeEnabled()
const CLEANING_MODE_MATCHING_ANY_TAG
getWebsites($withDefault=false, $codeKey=false)
const XML_PATH_SINGLE_STORE_MODE_ENABLED
getStores($withDefault=false, $codeKey=false)