Search code examples
phpshopwareshopware6

How to properly set up subfolders for each language and not break plugins?


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:

Storefront 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?


Solution

  • 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.