-
-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to switch store views - Magento 2 #47
Comments
@christian-walker Are you making those changes in
The above links show how to handle multi-site setups, and the 2nd one demonstrates how to setup store codes by domain for use on local (without impacting prod, stage, etc). |
Thanks @davidalger I'll take a look. |
@davidalger if I use |
@davidalger also for subdomains like this |
@christian-walker The domains can really be whatever you want them to be, no need for app to be there. That's merely the default. When you set the label As a general rule, for my own projects here at Mediotype, I actually tend to not use the app sub-domain and do something like site1.client.test and site2.client.test. Use what works best for you. |
@davidalger thanks, that makes sense. So for my second store I set it up with subdomain https://share.getcloudapp.com/jkunnLv5 But its still forwarding to the first site b2c.willhen.test |
@davidalger looks like I needed to run |
@davidalger I've added the |
@christian-walker Afraid not. Don't recall ever encountering an issue in which Magento redirects to the wrong store/website when the codes are properly set and passing to the application in $_SERVER as environment variables. Use of the stores.php file has worked quite reliably for me. I'd see what you can do to see why composer is not loading it (although if it's configured as outlined in the referenced links above, I'm at a loss on that one as well) |
For a project that I'm working on this is how we switch from store to store within the vagrant local env. that uses a docker container.
Within the index.php file:
$params = $_SERVER; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'extranet'; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store'; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params); /** @var \Magento\Framework\App\Http $app */ $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class); $bootstrap->run($app);
By doing this we're able to maintain the same url but switch themes based on the store code. This works in the vagrant env. however this doesn't seem to work in the warden env.
Any ideas why?
Thanks!
The text was updated successfully, but these errors were encountered: