Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails #145

Open
shyopat opened this issue Oct 1, 2024 · 3 comments

Comments

@shyopat
Copy link

shyopat commented Oct 1, 2024

import products in bulk causing error below

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (catalog_product_website, CONSTRAINT CAT_PRD_WS_PRD_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY (product_id) REFERENCES catalog_product_entity (entity_id) ON DELETE CASCADE), query was: INSERT INTO catalog_product_website (product_id,website_id) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?) ON DUPLICATE KEY UPDATE product_id = VALUES(product_id), website_id = VALUES(website_id)

please look into it

@sprankhub
Copy link
Member

Most probably, this has nothing to do with this extension. Spontaneous guess: You might try to add a product to the same website multiple times, which leads to this error. If you can share minimal data how this issue can be reproduced, we can have a look, but it sounds like an issue with the data you are passing to the importer.

@shyopat
Copy link
Author

shyopat commented Oct 3, 2024

Array
(
[0] => Array
(
[sku] => ELB6225
[price] => 699
[intact_product_type] => Standard
[sorting_order] => 82287
[qty] => 0
[manage_stock] => 1
[is_in_stock] => 1
[backorders] => 0
[special_price] => 599
[additional_attributes] => promotion_text=RRP €999
[next_available_date] => EMPTY__VALUE
)

[1] => Array
    (
        [sku] => E555
        [price] => 699
        [intact_product_type] => Standard
        [sorting_order] => 82288
        [qty] => 0
        [manage_stock] => 1
        [is_in_stock] => 1
        [backorders] => 0
        [special_price] => 599
        [additional_attributes] => promotion_text=RRP €999
        [next_available_date] => __EMPTY__VALUE__
    )

)

@sprankhub
Copy link
Member

You don't even have a website in your data. Did you try to add it? Maybe this helps.

Also, if you want someone to help, it always helps to share a minimal executable example. You posted your data now, but not the executable code how you import it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants