Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[SOLVED] SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row …
 
ShopMagCart
Member
 
Total Posts:  70
Joined:  2009-01-04
 

I’m upgrading from 1.3.2.4 to 1.5.1.0 and running into a problem during checkout.  I downloaded a full release and imported my old database into a new one.  When I try to submit the order, I receive a popup window saying the payment can not be processed and to try again later.  The error I am receiving is below:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`DATABASE_NAME/salesrule_product_attribute`, CONSTRAINT `FK_SALESRULE_PRODUCT_ATTRIBUTE_CUSTOMER_GROUP` FOREIGN KEY (`customer_group_id`) REFERENCES `customer_group` (`customer_group_id`) ON )

Does anyone have any idea of how to fix this?  I appreciate any help anyone can offer.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

Did you go through the upgrade process?

If you disable your shop cart rules do you still have this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopMagCart
Member
 
Total Posts:  70
Joined:  2009-01-04
 

Brent, thank you for your reply.  I went through the whole upgrade process.  I did disable the Mage_SalesRule module, cleared the cache, and it still generated the same error.  I thought it was odd since I disabled the module.  Do you think it would matter if I disabled it first and then went through the upgrade process?  What is the function of the Mage_SalesRule and do I need it?

I also ran across an magento-db-repair-tool-1.0.php and ran that against a new installation of Magento v1.5.1.0 without any change in the error.

Thanks again for your help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

Disabling the module will not do any good as disabling only disables the output and not the module itself.

You should leave it enabled during your upgrade, what I meant by disabling is that you disable the rule that is causing the error.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopMagCart
Member
 
Total Posts:  70
Joined:  2009-01-04
 

Is disabling the rule a hard coding task or is that something that can be disabled in the admin interface?  I’m at a loss on where to disable this error and what to look for.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

Your rules are under your promotions tab in admin. Do you have any that are created there?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopMagCart
Member
 
Total Posts:  70
Joined:  2009-01-04
 

Under “Cart Price Rules”, I have 4 there, but they are all inactive.
Under “Shopping Cart Price Rules”, I have 1 that is active and 9 that are inactive.

Is your thinking that I should delete all of them and rebuild only the ones I need to use?  Should I delete all of them only in “Cart Price Rules” or only in “Shopping Cart Price Rules” or both?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

Do you have a customer group that you deleted? I also noticed the problem maybe with your customer group.

Perhaps change the groups in your rules to everyone

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopMagCart
Member
 
Total Posts:  70
Joined:  2009-01-04
 

Brent, thank you for pointing me in the right direction.  I found out it was a free shipping rule I had setup up.  I disabled it, then re-enabled it to get the error to disappear.  Now I can move onto testing the rest of the site.

I appreciate all your help and replies back to my multiple reply posts.

 
Magento Community Magento Community
Magento Community
Magento Community
 
diglin
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2008-12-29
Zurich - Switzerland
 

You can try too to make a database repair. in case of problem with your database and foreign keys: Magento DB Repair tool Wiki

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopMagCart
Member
 
Total Posts:  70
Joined:  2009-01-04
 

@Sylvain R. 
I tried the database repair tool originally and it did not clear up this specific error.  It reported back that it did make some database corrections, but nothing noticeable changed during my testing.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

@ ShopMagCart:: What error are you getting ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopMagCart
Member
 
Total Posts:  70
Joined:  2009-01-04
 

@Brent W Peterson
No new errors after you gave me the last advice.  I was responding to the Sylvain R post about doing a database repair after you already helped me fix the error.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top