pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[Bug]: Categories/Products URLs are not changed when switching between store with differents languages

Open Seeila opened this issue 3 years ago • 3 comments

Describe the bug Hi,

My team is developing a pwa-studio solution for multilingual websites (fr-en) and we came across an issue: The client have usually already a Magento website and are using translated urls for their products and categories. When changing the language, it works fine if the url key stays the same and is not translated, but if the url key is translated, the path is not updated to the translated one and we arrive most of the time on a 404 page.

When it's a top category or a product, it does change the url to the translated one from the default language to the translated one, but it's not working from the translated one to the default one.

When it's a subcategory, from the default language to the translated one it doesn't replace the whole url (from https://xxx.pwadev:8602/default/venia-bottoms/venia-pants.html to https://xxx.pwadev:8602/fr/venia-bottoms/bas-venia/pantalons-venia.html). And from the translated one to the default one, it doesn't work.

To reproduce

Steps to reproduce the behaviour:

  1. In Magento got to a Category/Subcategory
  2. Switch the Scope to a store view with a different language from the default one
  3. Change the name and the url_key (in search Engine Optimization)
  4. On Venia, navigate to a category in your default store
  5. Switch to the store with the other language
  6. Switch back to the default store

Expected behaviour The paths should change to the translated ones or be able to find the default one when switching stores

Screenshots

Screenshot from 2021-08-02 15-19-53 Screenshot from 2021-08-02 15-12-34 Screenshot from 2021-08-02 15-14-13

Possible solutions

I haven't had the time to dive deep into the code to find a solution. Since we are going live very soon, do you have a short term solution to this problem or some insights where to look? I was going to use the urlResolver to get the id of the category/product and then after switching the language, find the url_key from the id and make a redirection.

Edit: after having looked more in depth at the bug, it seems that the urlResolver doesn't return a redirectCode when switching from the translated url to the default one and on Magento, when using the url rewrites, form the rewritten url to the default url is the path of the product/category in the admin and not the url key. So part of the problem comes from Magento (I guess) but the fact that the whole url is not replaced for the subcategories comes from Peregrine

Please complete the following device information:

  • Pc on Ubuntu:
  • Chrome 91, Firefox 90:
  • Magento EE 2.4.2

Please let us know what packages this bug is in regards to:

  • [ ] venia-concept
  • [ ] venia-ui
  • [ ] pwa-buildpack
  • [X] peregrine
  • [ ] pwa-devdocs
  • [ ] upward-js
  • [ ] upward-spec
  • [ ] create-pwa

Seeila avatar Aug 02 '21 19:08 Seeila

Hi @Seeila. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Aug 02 '21 19:08 m2-assistant[bot]

@magento export issue to JIRA project PWA as Bug

anthoula avatar May 23 '22 14:05 anthoula

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2876 is successfully created for this GitHub issue.

github-jira-sync-bot avatar May 23 '22 14:05 github-jira-sync-bot

Hi @Seeila,

As per retesting the issue we are not able to reproduce it and working fine.

Followed steps to reproduce :

  1. In Magento got to a Category/Subcategory
  2. Switch the Scope to a store view with a different language from the default one
  3. Change the name and the url_key (in search Engine Optimization)
  4. On Venia, navigate to a category in your default store
  5. Switch to the store with the other language
  6. Switch back to the default store

Note: Kindly let us know if we are missing any step to reproduce on above. So that we can proceed further to reproduce the issue else will close it.

@RaghavendraTirumalasetti it has been resolved since the update to 2.4.3 and PWA-Studio v13, thank you

Seeila avatar May 17 '23 13:05 Seeila