50 \
Magento\Framework\
Data\Helper\PostHelper $postDataHelper,
52 UrlHelper $urlHelper =
null 54 $this->_postDataHelper = $postDataHelper;
55 parent::__construct($context,
$data);
66 return $this->_storeManager->getStore()->getWebsiteId();
76 return $this->_storeManager->getStore()->getGroupId();
86 return $this->_storeManager->getStore()->getId();
96 if (!$this->
hasData(
'raw_groups')) {
97 $websiteGroups = $this->_storeManager->getWebsite()->getGroups();
100 foreach ($websiteGroups as
$group) {
103 $this->
setData(
'raw_groups', $groups);
105 return $this->
getData(
'raw_groups');
115 if (!$this->
hasData(
'raw_stores')) {
116 $websiteStores = $this->_storeManager->getWebsite()->getStores();
118 foreach ($websiteStores as
$store) {
120 if (!
$store->isActive()) {
123 $localeCode = $this->_scopeConfig->getValue(
128 $store->setLocaleCode($localeCode);
131 $params[
'_query'][
'___store'] = $store->getCode();
135 $store->setHomeUrl($baseUrl);
140 return $this->
getData(
'raw_stores');
150 if (!$this->
hasData(
'groups')) {
155 $localeCode = $this->_scopeConfig->getValue(
159 foreach ($rawGroups as
$group) {
161 if (!isset($rawStores[
$group->getId()])) {
176 $this->
setData(
'groups', $groups);
178 return $this->
getData(
'groups');
188 if (!$this->
getData(
'stores')) {
199 return $this->
getData(
'stores');
209 return $this->_storeManager->getStore()->getCode();
219 if ($this->_storeInUrl ===
null) {
220 $this->_storeInUrl = $this->_storeManager->getStore()->isUseStoreInUrl();
232 return $this->_storeManager->getStore()->getCode();
242 return $this->_storeManager->getStore()->getName();
256 $data[
'___from_store'] = $this->_storeManager->getStore()->getCode();
258 $urlOnTargetStore =
$store->getCurrentUrl(
false);
261 $url = $this->
getUrl(
'stores/store/redirect');
263 return $this->_postDataHelper->getPostData(
getData($key='', $index=null)
getTargetStorePostData(Store $store, $data=[])
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Data\Helper\PostHelper $postDataHelper, array $data=[], UrlHelper $urlHelper=null)
getUrl($route='', $params=[])
const PARAM_NAME_URL_ENCODED
setData($key, $value=null)
const XML_PATH_DEFAULT_LOCALE
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]