- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2019
04:43 AM
05-24-2019
04:43 AM
Re: Redirected automatically to a store view based on a user group - M2
I have read this manual and I have adapted my code with this:
<?php namespace MyPlugin\CustomerLogin\Plugin; class LoginPostPlugin { public function afterExecute( \Magento\Customer\Controller\Account\LoginPost $subject, $result) { //-- check group is retail customer or not $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManager->create('Magento\Customer\Model\Session'); if ($customerSession->isLoggedIn()){ $groupId = $customerSession->getCustomerGroupId(); if ($groupId == 2){ $result->setPath('?___store=Wholesale&___from_store=Wholesale'); } } return $result; } }
And the view changes to the selected view (wholesale), but when I open a product or a category, the view changes to the predefined view, the change does not become effective. Any other idea of being able to make the fixed exchange?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2019
07:12 AM
05-27-2019
07:12 AM
Re: Redirected automatically to a store view based on a user group - M2
Does anyone know how to solve this?
- « Previous
-
- 1
- 2
- Next »