Skip to content

Fix: Save translations for an attribute#319

Merged
ahuininga-orisha merged 20 commits intobetafrom
fix-filter-slugs
Dec 9, 2025
Merged

Fix: Save translations for an attribute#319
ahuininga-orisha merged 20 commits intobetafrom
fix-filter-slugs

Conversation

@ahuininga-orisha
Copy link
Collaborator

@ahuininga-orisha ahuininga-orisha commented Oct 29, 2025

🛠️ Pull Request Fixes: Tweakwise attribute/filter issues

This pull request resolves two distinct issues related to how attribute values are saved and displayed in the system, specifically concerning the tweakwise_attribute_slug table and multi-store translations.

Slugs are now saved with the associated store ID. A dedicated cron job has been implemented to allow for slug regeneration.

If you encounter any issues with existing slugs (e.g., URLs containing -1), or simply wish to regenerate them, you may run this cron job.

⚠️ Important: Running the regeneration cron can modify existing URLs, which may impact your SEO for filter pages.

bin/magento tweakwise:regenerate:filter-url-slugs

This pull request requires EmicoEcommerce/Magento2TweakwiseExport#130 to work


Issue 1: Attribute value translation saving

Problem: Attribute value translations for different store views were not being saved correctly to the tweakwise_attribute_slug table. Only the default store view value was recorded.

How to Reproduce:

  1. Modify an attribute (e.g., "Size") that has multiple values.
  2. Enter different translations for one of the attribute values for different store views.
  3. Save the attribute.
  4. Observation: Only the default value is saved in the tweakwise_attribute_slug table; the translations are missing.

I've solved this issue by adding the store id to the table. Without the store id, the the primary key was the attribute value. But some values where spelled differently, but mysql saw it as the same value (for example cortenová oceľ and cortenová ocel)


Issue 2: Incorrect slug for changed filter values

Problem: When a attribute value is used in a filter and has an modified spelling, the resulting slug on the front-end category page can be incorrect, even though the new value is saved correctly in the database.

How to Reproduce:

  1. Check the initial filter value (e.g., "one") in the tweakwise_attribute_slug table. It will have a slug (e.g., "one").
  2. Overwrite this value in Tweakwise using a derived attribute with different spelling (e.g., "onê").
  3. Ensure this derived attribute is active in the filter template.
  4. Save and publish the changes in Tweakwise.
  5. Ensure the url strategy is set to path
  6. Go to a category page that uses this filter.
  7. Observation A (Front-end): The filter option displays "onê," but its URL slug is still incorrect (e.g., "one" instead of the expected "one-1" or the value found in step 8).
  8. Observation B (Database): The derived value, "onê," is saved in the tweakwise_attribute_slug table, but its slug value is set to "one-1" (which wasn't used on the category page), indicating a mismatch in how the slug is generated and used.

@ahuininga-orisha ahuininga-orisha marked this pull request as draft October 31, 2025 09:54
Copy link
Collaborator

@jansentjeu jansentjeu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the description i see the following:

This pull request requires https://github.com/EmicoEcommerce/Magento2TweakwiseExport/pull/130 to work

So we need to require a specific new version of the Tweakwise export module, right? We have to require that in the composer.json.

@ahuininga-orisha ahuininga-orisha merged commit 8906f67 into beta Dec 9, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants