What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Did anyone set multi store under one domain, something like

UKHD8KTMF
UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

Did anyone set multi store under one domain, something like www.mybrand.com/shop1 and www.mybrand.com/shop2 ? Anything I should be taking care of? Right now we have shop1.mybrand.com and shop2.mybrand.com but due to SEO requirements we need to change.

Comments

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    We currently do this for one of our customers (not yet live).
    Prepare yourself for a lot of work and a nightmare of memory leaks during publish.

    Do you need to know which url is available in which store (e.g.: Store A has URL /a/foo that is /b/bar in Store B) for alternate tags in the html head? Have fun building that yourself.

    Want to publish a product concrete/abstract from the same DB but in multiple stores -> be prepared for really big result sets due to missing batching and inefficient queries.

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    we do not have that many products and we do not have the same product in both stores, so I hope we will not have the problems you are describing. Anything else that was a problem with a setup itself? Like routing or something?

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer
    edited January 2023

    Routing pretty much depends on what routing schema you already have. Is a Store prefix already included in the Url, then you are good to go. If not you not you will need to migrate all existing urls to include a store prefix. You will also need to match the store from the store prefix in the url and initialize the right store and locale in Spryker\Shared\Config\Application\Environment::initialize. We also implemented a RouterEnhancerPluginInterface to add the store prefix to all internal urls and strip it from incoming urls

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    We also had to adapt SprykerShop\Yves\StorageRouter\UrlGenerator\StorageUrlGenerator to add the store prefix to the url.

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 πŸ§‘πŸ»β€πŸš€ - Cadet

    we also did it in a current project. You also have to take care of executing zed in the correct store context in some cases (e.g. recalculating cart was a problem for us). And symfony forms which have the action url included, you need to prefix them with the store url or somehow else set the correct store context in the post request (in summary, you have to make sure, that in the complete request chain, when you do something in the store, the store context is set correctly all the time in all requests, otherwise it can have some pretty drastic side effects, like 0 prices in cart, if you switch price mode between the stores, or an empty cart suddenly etc.)

  • U01BZ7Q3XRV
    U01BZ7Q3XRV Posts: 148 πŸ§‘πŸ»β€πŸš€ - Cadet

    it was a lot of debugging work in the end to find all the cases, where the store context was not set correctly, yet

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    thank you all for the update