Magento 2 Mage के लिए समान :: ऐप () -> setCurrentStore (Mage_Core_Model_App :: ADMIN_STORE_ID)

Aug 28 2020

मैं निम्नलिखित कोड का उपयोग कर रहा हूं: -

Mage :: app () -> setCurrentStore (Mage_Core_Model_App :: ADMIN_STORE_ID)

उसी कोड को मैं Magento2 के लिए उपयोग करना चाहता हूं, मैं कैसे प्राप्त कर सकता हूं?

जवाब

1 SohelRana Aug 27 2020 at 23:30

कुछ इस तरह:

$this->storeManager->setCurrentStore(0);

जहाँ $ यह-> storeManage Magento \ Store \ Model \ StoreManagerInterface का एक उदाहरण है

Ex:

public function __construct(
    \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->storeManager = $storeManager;
}