We are launching a Shopware 6 website and want to acomplish the following URL strucutre:
https://example.com/de -> German Language
https://example.com/en -> English Language
We currently have tree entries in the the Storefront’s domain configuration:
The problem here is, that the language switcher always defaults to the shortest (?) URL when switching stores, i.e. when switching from EN to DE, it picks https://example.com instead of https://example.com/de.
We have the entry (1) in the domain configuration, because without it, plugins break (they cannot properly generate their API URLs anymore).
Is this a problem in the plugins and should it be possible to just delete (1) or are we supposed to make the configuration differently?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Based on the comments of @j_elfering and @mnaczenski I reported to the plugin vendor who released a fix very quickly.
I believe this is the important change in the module. It’s not really accessing the store API but a normal controller:
diff:
- window.router['example.widgets.topbar'] = '{{ url('example.widgets.topbar') }}'; + window.router['example.widgets.topbar'] = '{{ seoUrl('example.widgets.topbar') }}';
So it is important to use the seoUrl
helper instead of url
This seems to be a common mistake, as we are using a second extension (different vendor) with the same problem.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0