How to merge duplicate attributes in PrestaShop without breaking combinations
Over the years almost every catalogue ends up with "Colour" and "Shoe colour", "Size" and "Sizes", or "Red" repeated inside the same group. The result is duplicated filters that confuse shoppers and a catalogue that is hard to maintain. Merging them looks simple, but it touches the heart of PrestaShop: combinations. That is why we built Attribute Fusion.
Why it is not trivial in PrestaShop
- Combinations depend on values. When one value replaces another, two combinations of the same product can end up identical, each with its own stock, carts and packs.
- A combination may have one value from each group being merged, and can only keep one.
- The structure changes between versions. Before PrestaShop 1.7.3 a product accepts only one value per feature; after it, several.
- Multistore: each group and value is linked to one or more shops.
- A half-finished run leaves the catalogue broken, and in large stores the operation affects tens of thousands of combinations.
The approach: see before you touch
The module works as a three-step wizard. First it detects likely duplicates: groups with the same name, one name contained in another or half of their values in common, ignoring case, accents and spaces. Then it proposes how to pair the values. And before applying, it shows what will change and every conflict product by product, so the merchant decides.
Technical decisions
A plan validated at every step
The wizard keeps no intermediate state: each step sends the groups, target and pairing again, and the plan is validated against the database once more. An outdated plan, or one with impossible merge chains, is never applied.
All or nothing
The merge runs inside a transaction. If anything fails, nothing changes. Leftover values and groups are removed with the core's own methods, and the template cache is cleared at the end.
Conflicts resolved with judgement
When two combinations become identical, the merchant chooses per product between joining them or leaving them for review. Joining keeps the default or the oldest one, adds up the available stock of each shop and moves carts and packs to the one that stays.
No impact on the store
The module uses no front-office hooks: it does not affect store speed and does nothing until a merge is applied, which is logged in a history with the employee who ran it.
Limits stated clearly
A merge cannot be undone, so a backup confirmation is required every time. The faceted search index has to be rebuilt afterwards, and modules that store attribute identifiers in their own tables (feeds, ERP) are not updated. We document this rather than hide it.
What we learned
Changing the catalogue in bulk requires a solid understanding of PrestaShop's data model and how it changes between versions. It is the same knowledge a migration, a mass import or an ERP integration needs.
What this development demonstrates
- Command of the attribute, combination and feature data model
- Structural differences between PrestaShop versions
- Bulk operations in a single transaction, with no half-finished states
- Duplicate detection with name normalisation
- Handling stock, carts and packs when joining combinations
- Multistore support