Magento 2 Equivalent for Mage :: app () -> setCurrentStore (Mage_Core_Model_App :: ADMIN_STORE_ID)
Aug 28 2020
Sto usando il seguente codice: -
Mage :: app () -> setCurrentStore (Mage_Core_Model_App :: ADMIN_STORE_ID)
Lo stesso codice che voglio usare per Magento2, come posso ottenerlo?
Risposte
1 SohelRana Aug 27 2020 at 23:30
Qualcosa di simile a:
$this->storeManager->setCurrentStore(0);
Dove $ this-> storeManage è un'istanza di Magento \ Store \ Model \ StoreManagerInterface
Ex:
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->storeManager = $storeManager;
}