3

I found there is issue with row_id and entity_id in this catalog_product_entity. I'm not able to assign product to category, it gives this error:

Something went wrong while saving the category.SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (mydb.catalog_category_product, CONSTRAINT CAT_CTGR_PRD_PRD_ID_SEQUENCE_PRD_SEQUENCE_VAL FOREIGN KEY (product_id) REFERENCES sequence_product (sequence_value) ON DELETE CA), query was: INSERT INTO catalog_category_product (category_id,product_id,position) VALUES (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?)

Table values in database is:

enter image description here

  • Can you please let me know how you have resolved this issue – mjdevloper Apr 29 at 8:40
  • i have empty all tables of products and categories. – Jimit Bhavsar Apr 30 at 4:59
0

We have faced the similar issue on Magento commerce after upgrading to 2.1.6 to 2.1.17. After investigating further, I found Magento_VisualMerchandiser creating the issue. When I disabled it, no sql error is displaying when assigning product to a categories.

Although this is not the solution, But it will be help full.

Ref- https://github.com/magento/magento2/issues/16227

  • yes, there is some issue with save position: Magento\VisualMerchandiser\Block\Adminhtml\Category\Merchandiser\Tile – Jimit Bhavsar Apr 30 at 9:21
  • after comment of save position script, assign product to category functionality is working good – Jimit Bhavsar Apr 30 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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