sitemap-plugin icon indicating copy to clipboard operation
sitemap-plugin copied to clipboard

Wrong locale context for multi channels

Open Giraudierpierre opened this issue 9 months ago • 3 comments

Sylius version : 1.13.5 Sitemap plugin version : 2.4.3

Hello,

I encounter an error generating sitemap with multiple channels having different locales.

Image

The error occurs in ProductUrlProvider because of the localeContext that always returns base locale "fr_FR". How can I fix it ?

Thanks by advance.

Giraudierpierre avatar Mar 20 '25 16:03 Giraudierpierre

Hi @Giraudierpierre It's a bit hard to say without more information. Can you produce an error with more details? I cannot reproduce this at the moment.

stefandoorn avatar Mar 21 '25 08:03 stefandoorn

Hello @stefandoorn

The error occures when I create 2 channels with fr locale for the first and en locale for the second one. It's important that the second channel does not have the default locale fr.

I think this pull request tried to fix the same problem : https://github.com/stefandoorn/sitemap-plugin/pull/197

Giraudierpierre avatar Mar 21 '25 09:03 Giraudierpierre

Sylius: 2.0.7 Sitemap plugin: 3.0.0-alpha3 (latest alpha)

I can confirm the same problem - two channels, each with a different locale. The sitemap generation fails with the above mentioned error.

How to reproduce

  • Channel A
    • code: default
    • url: https://www.example.com
    • default_locale: en_US
    • locales:
      • en_US
  • Channel B
    • code: de
    • url: https://www.example.de
    • default_locale: de_DE
    • locales:
      • de_DE

Running bin/console sylius:sitemap:generate -c de runs into an error.

codedge avatar May 10 '25 12:05 codedge