avstudnitz / AvS_FastSimpleImport

Wrapper for Magento ImportExport functionality, which imports products and customers from arrays
308 stars 146 forks source link

product_super_attribute_id table // SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row #353

Open seansan opened 7 years ago

seansan commented 7 years ago

Hi, we are importing some products. And thought I'd report this. We import 100 products and sometimes 1 or 2 are in error. We have meticulously checked the files .... but our conclusion is that there is no error in the file. Can this be a glitch of FSI?

Import CSV looks like this: https://gist.github.com/seansan/61b1efd5b7c302b6c92d84f944633344

No idea why the SQL error. @cmuench maybe this is our error, or maybe it is something in the code

Thought I'd share it here

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`shirts`.`catalog_product_super_attribute_label`, CONSTRAINT `FK_C55E99A9D48D68F520C7B49F1BD03205` FOREIGN KEY (`product_super_attribute_id`) REFERENCES `catalog_product_super_attribute` (`pro), query was: INSERT INTO `catalog_product_super_attribute` (`product_super_attribute_id`,`position`,`product_id`,`attribute_id`) VALUES (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?) ON DUPLICATE KEY UPDATE `product_super_attribute_id` = VALUES(`product_super_attribute_id`), `position` = VALUES(`position`), `product_id` = VALUES(`product_id`), `attribute_id` = VALUES(`attribute_id`)
cmuench commented 7 years ago

@seansan We had similar problems with linked products. The problem was the way how Magento chunks data in bunches.

seansan commented 7 years ago

OK thanks - just glad it is not us. Is there anything we can do about it? Add an order_by column in the import file? (start with row 1 etc) .... any help appreciated

cmuench commented 7 years ago

I'm not sure if this was fixed in Magento. We have written our own import routine for linked products. In your case it looks like a problem with attribute processing.

@avstudnitz Do you know this problem?

seansan commented 7 years ago

We have written our own import routine for linked products You mean outside this extension (own code)?

if/else own code would you be able to share it /w me? I have 99% configurables so would be quite interested. thx sean

cmuench commented 7 years ago

@seansan It's implemented in an internal module. I cannot share it.