0

In Magento 2.4.5, the shop "lost" somehow some associations from configurable to simple product. These simple products are no longer associated with their parent configurable product. The share the same SKU prefix.

I can find them with "Add Products Manually" and filtering for the parent SKU and associate them again to their parent product. But on some products, I run into an error after clicking "Add Products Manually", as you can see in the screenshot. Does anybody know what this error is and why it is showing up? How can I fix this?

I tried several solutions, that I found during my search (Checking if SKUs == null, emptying ui_bookmarks table,...), but found no solution so far.

Additional Question. Would it be OK (I am avoiding the word safe ;-)) to do this directly in the database? Or does Magento need something else to be also 'run' when doing this (for something like finalizing things)?

INSERT INTO catalog_product_super_link (parent_id, product_id)
SELECT (
    SELECT entity_id 
    FROM catalog_product_entity 
    WHERE sku = 'parentSKU'
), entity_id
FROM catalog_product_entity
WHERE sku LIKE 'parentSKU%' 
  AND type_id = 'simple'
  AND entity_id NOT IN (
    SELECT product_id 
    FROM catalog_product_super_link 
    WHERE parent_id = (
      SELECT entity_id 
      FROM catalog_product_entity 
      WHERE sku = 'parentSKU'
    )
  );

Here is a screenshot of the error I get, when trying to associate the 'parentless' simple products.

Error, that I get when trying to fix

1 Answer 1

0

I did it with the above SQL, which worked. The error in the GUI still persists and I can't do it in the User Interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.