Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help wanted] Slug field inside localized fields and unique constraints #2782

Open
shadowinek opened this issue Jan 17, 2025 · 4 comments
Open

Comments

@shadowinek
Copy link

shadowinek commented Jan 17, 2025

Hi,

I need a help with our issue we have. We are currently in the process of upgrading CoreShop to the latest versions. Currently we are blocked by version 3.0.5, because of this bugfix - #2236

Our setup

We have a CoreShopProduct, that includes slug field type inside Localized fields
Image

We have multiple languages and some of them have fallback.
Image

Our issue

After the upgrade we are getting an error page
Image

This is caused, because we are trying to create "blank" product that is then possible to edit with data. While creating this product the slugs for all languages are getting generated. This is no issue for the languages without fallback language. But when a language has a fallback, we get a duplicated slug. When we try to save the object, we get an error.

Example slugs before the change:
Language: en - /en/678a5894d1c76-2025-01-17-14-18-12
Language: de - /de/678a5894d1c76-2025-01-17-14-18-12
Language: fr - /fr/678a5894d1c76-2025-01-17-14-18-12
Language: es - /es/678a5894d1c76-2025-01-17-14-18-12
Language: it - /it/678a5894d1c76-2025-01-17-14-18-12

Example slugs after the change:
Language: en - /en/678a586975333-2025-01-17-14-17-29
Language: de - /de/678a586975333-2025-01-17-14-17-29
Language: fr - /en/678a586975333-2025-01-17-14-17-29
Language: es - /en/678a586975333-2025-01-17-14-17-29
Language: it - /en/678a586975333-2025-01-17-14-17-29

Questions

  • Did anyone have the same issue? What is your solution?
  • Is our setup wrong and we should not use slugs inside localized fields at all? What is the common way to have different slugs for multiple language versions?

Thanks.

@dpfaffenbauer
Copy link
Member

@shadowinek hey, thanks for using CoreShop :)

Why are you blocked on 3.0.5?

My suggestion would be to just overwrite the Slugger and create your own that disables or not uses the language fallbacks. Is this bug still available in the latest 3.2 and something we can fix or help with? You can also contact me directly under [email protected] if you don't know how to solve it and we can help you directly.

@shadowinek
Copy link
Author

Hey @dpfaffenbauer,

thanks for the quick reaction. By blocked I meant more of a soft block. For now we extended the DataObjectSlugGenerator that causes us issues and we are using the old implementation for it. Thanks to this we are able to continue with upgrading further.

From the changelog I can see that the DataObjectSlugGenerator didn't change at all since the mentioned bugfix, so it would cause us issues even when we catch up with the latest versions.

So we found a solution, but I am not really sure it is a correct way how to deal with it and wanted to find if anyone encountered the same issue we have.

The only similar issue I found on pimcore repository, but this feels more connected to coreshop to me - pimcore/pimcore#11697

@dpfaffenbauer
Copy link
Member

I am pretty sure its a bug, but not sure if its fixed already. so in your case, I would just go on, see if it works and let me know again if it doesn't. and then we can properly fix it.

@dpfaffenbauer
Copy link
Member

@shadowinek any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants