1

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?

4
  • did it happen to all or only for specific products?
    – fmsthird
    Apr 23, 2019 at 21:10
  • I haven't tested every product but so far every product we've tried we receive that error when trying to assign a related / upsell / crossell product
    – AJK
    Apr 23, 2019 at 21:15
  • did you chrck this magento.stackexchange.com/questions/147183/…
    – fmsthird
    Apr 23, 2019 at 21:20
  • 1
    oh I see, I'll try that.. both of my tables are empty as that comment describes
    – AJK
    Apr 23, 2019 at 21:48

2 Answers 2

5

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');
3
  • 1
    Thanks, its worked for me, please run query in reverse order else it will throw foreign key exception Oct 21, 2019 at 9:08
  • hello , i checked in my database already same tables with these data. how to resolve this error ? Mar 11, 2020 at 7:35
  • what if we get this error while the tables are properly populated ? :/
    – Claims
    May 23, 2022 at 13:01
0

Indeed, I get this message while the database is already correct. So what then?

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.