mirror of
https://github.com/foomo/Foomo.Magento2.git
synced 2025-10-16 12:35:34 +00:00
additional store management methods
This commit is contained in:
parent
f951455f69
commit
a19bd55adf
@ -101,6 +101,26 @@ class Boostrap
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $storeId
|
||||
* @return \Magento\Store\Api\Data\StoreInterface | false
|
||||
*/
|
||||
public static function getStoreById($storeId)
|
||||
{
|
||||
if (!class_exists('\Magento\Framework\App\Bootstrap')) {
|
||||
self::init();
|
||||
}
|
||||
/* @var \Magento\Store\Model\StoreManagerInterface $storeManager */
|
||||
$storeManager = \Magento\Framework\App\ObjectManager::getInstance()->get('\Magento\Store\Model\StoreManagerInterface');
|
||||
foreach ($storeManager->getStores() as $store) {
|
||||
if ($store->getId() == $storeId) {
|
||||
return $store;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set current store
|
||||
* @param string $storeCode
|
||||
@ -117,6 +137,21 @@ class Boostrap
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set current store
|
||||
* @return string \Magento\Store\Api\Data\StoreInterface | false
|
||||
*/
|
||||
public static function getCurrentStore()
|
||||
{
|
||||
if (!class_exists('\Magento\Framework\App\Bootstrap')) {
|
||||
self::init();
|
||||
}
|
||||
$storeManager = \Magento\Framework\App\ObjectManager::getInstance()->get('\Magento\Store\Model\StoreManagerInterface');
|
||||
return $storeManager->getStore();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Magento\Store\Api\Data\WebsiteExtensionInterface
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user