Magento 2.3: Error Assigning Related Products
-
27-02-2021 - |
Domanda
Trying to add some related / cross-sell and upsells to products in the admin but receiving the following error after saving the product:
The linked products data is invalid. Verify the data and try again.
I checked my exception log and saw this:
main.CRITICAL: The linked products data is invalid. Verify the data and try again. {"exception":"[object] (Magento\\Framework\\Exception\\CouldNotSaveException(code: 0): The linked products data is invalid. Verify the data and try again. at /srv/public_html/vendor/magento/module-catalog/Model/ProductLink/Repository.php:141)"} []
What could be the issue here?
Soluzione
I was able to fix this:
First check the following tables in your DB:
catalog_product_link_attribute
and catalog_product_link_type
If those are empty, you need to run the following SQL queries:
INSERT INTO `catalog_product_link_attribute` (`product_link_attribute_id`, `link_type_id`, `product_link_attribute_code`, `data_type`) VALUES
(1, 1, 'position', 'int'),
(2, 4, 'position', 'int'),
(3, 5, 'position', 'int'),
(4, 3, 'position', 'int'),
(5, 3, 'qty', 'decimal');
INSERT INTO `catalog_product_link_type` (`link_type_id`, `code`) VALUES
(1, 'relation'),
(3, 'super'),
(4, 'up_sell'),
(5, 'cross_sell');
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange