SHARE
TWEET

Untitled

a guest Jun 27th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <event name="controller_action_predispatch">
  2.     <observer name="switch_store" instance="NamespaceModulenameObserverSwitchStore" shared="false" />
  3. </event>
  4.      
  5. protected $storeManager;
  6.  
  7. public function __construct(
  8.     MagentoStoreModelStoreManagerInterface $storeManager
  9. ) {
  10.     $this->storeManager = $storeManager;
  11. }
  12.  
  13. public function execute(MagentoFrameworkEventObserver $observer) {
  14.     if ($this->firstVisit()) { // Customer's first visit logic inside firstVisit() function
  15.         $storeId = $this->storeManager->getStore($target_store)->getId();
  16.         $this->storeManager->setCurrentStore($storeId);
  17.     }
  18.     return $this;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top