DataFirefly Fix Product Category: assign products to their parent categories
Installation, dry run and bulk fix, automatic mode, exclusions and troubleshooting.
Installation
Install the module from Modules > Module Manager > Upload a module by sending the ZIP file, or drop the dffixproductcategory folder into the /modules/ directory of your shop and click Install.
Installation adds the Fix product categories tab under the Catalog menu and registers the hooks used by the automatic mode. No table is created: the module only writes to the native category_product table.
The bulk fix adds associations across the whole catalog. Back up the category_product table before the first fix, so you can roll back if the result does not match how your catalog is organised.
How it works
For each category of a product, the module walks up the tree to the top and adds the parent categories the product is not yet assigned to. All the categories of the product are taken into account, not only its default category.
Example: a product assigned only to Shoes > Running > Trail is added to Running and to Shoes. The Root category is never added, and the Home category only when the matching option is enabled.
- No existing association is removed.
- The default category of the product is never changed: the breadcrumb and the product URL stay the same.
- The product is placed last in each category it is added to, which preserves your manual sorting.
- The tree is read from the parent of each category, so the result stays correct even when the PrestaShop nested set has not been regenerated.
Bulk fix
Open Catalog > Fix product categories. The Bulk correction panel processes the whole catalog in batches, with a progress bar.
Simulate
Click Simulate. Nothing is written. The counters show the number of products in scope, the products to fix and the missing associations. The preview table lists the first 100 affected products with the categories they will receive.
Fix the catalog
Click Fix the catalog and confirm. Batches run until the end of the catalog and the Associations added counter shows the result. You can run the fix again at any time: products already fixed are left untouched.
Only active products
Tick this box to limit the dry run and the fix to the active products of the current shop. By default every product is processed, disabled ones included, so they are filed correctly the day you enable them again.
Settings
Include the Home category
Disabled by default. Once enabled, the Home category is added like any other parent. In multistore, each shop has its own Home category and the setting applies to each of them.
Automatic mode on product save
Enabled by default. Every created or updated product is assigned to its parent categories. Processing happens at the end of the request, after the product categories have been saved, which covers the PrestaShop 8 and 9 product page, CSV import and the webservice.
Automatic mode on category move
Enabled by default. When you change the parent of a category, every product of its branch is assigned to the new parents. Editing the name or the description triggers nothing. The former parents stay assigned to the products: remove them manually if needed.
Excluded categories
Select the categories that must never be added as parents, such as a Sale or New arrivals showcase category. The filter field finds a category by name, and Ctrl (Cmd on Mac) selects several. An excluded category is skipped, but its own parents are still added.
Batch size
Number of products processed per request during the bulk fix, from 20 to 2000. The default value, 200, suits most hosting plans. Lower it if a request exceeds the maximum execution time of your server.
Faceted search
After each batch of new associations, the module clears the filter block cache of ps_facetedsearch, so the filters of parent categories take the new products into account. Since the associations exist in the database, the faceted search option that displays subcategory products is not needed.
Best practices
- Run a dry run before the first fix and go through the preview to validate the result.
- Set your exclusions before the bulk fix, not after: the module never removes an association it created.
- After a large import, run a bulk fix again to check that no product was missed.
- Clear the shop cache if a listing does not show the new products right away.
Troubleshooting
The automatic mode does not run for some employees
PrestaShop skips the hooks of a module when the profile of the logged-in employee lacks the View permission on that module (Advanced Parameters > Team > Permissions, Modules section). Grant this permission to the profiles that edit the catalog, or run a bulk fix after their changes.
A category removed from a product comes back on save
This is the expected behaviour of the automatic mode: every parent of a category of the product is added again. Add that category to the exclusions, or also remove the related subcategory from the product.
The bulk fix stops on an error
Lower the batch size and run it again: products already processed are skipped on the next pass. Errors from the automatic mode are recorded in Advanced Parameters > Logs and never block the product save.
Compatibility
- PrestaShop 8.0 to 9.x, the same ZIP covers both branches.
- Multistore and multilingual.
- ModuleAdminController architecture, no Composer dependency.
- Interface available in French, English, Spanish, German, Italian, Dutch, Polish and Portuguese.