Vote up!
Vote down!

[SOLVED] PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062

Hello everybody
I'm almost ready to launch the http://www.solidalbuy.com platform but I have an annoying problem :-(
I solved the calculation for the shipping according to weight and size of the package.

Now when I insert a product in tha cart I get this error:

The website encountered an unexpected error. Please try again later.

From the log report

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'commerce_order-13-0-0-und' for key 'PRIMARY': INSERT INTO {field_data_commerce_order_total} (entity_type, entity_id, revision_id, bundle, delta, language, commerce_order_total_amount, commerce_order_total_currency_code, commerce_order_total_data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => commerce_order [:db_insert_placeholder_1] => 13 [:db_insert_placeholder_2] => 13 [:db_insert_placeholder_3] => commerce_order [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => EUR [:db_insert_placeholder_8] => a:1:{s:10:"components";a:1:{i:0;a:3:{s:4:"name";s:10:"base_price";s:5:"price";a:3:{s:6:"amount";i:0;s:13:"currency_code";s:3:"EUR";s:4:"data";a:0:{}}s:8:"included";b:1;}}} ) in field_sql_storage_field_storage_write() (linea 514 di /home2/risolida/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

In admin/config/workflow/rules/settings/ I activate the debug

I try do disable the rules tha appear in the log file but nothing change :-(

Some one can help me ?

Asked by: Janhu
on May 16, 2016

1 Answer

Vote up!
Vote down!

I fond a solution.

This problem arises after you have deleted all orders created for testing in admin/commerce/orders
The table field_data_commerce_order_total is not empty, and this generates the error.

My manual solution:

TRUNCATE `field_data_commerce_order_total`;

I think is better do the same things for commerce_line_item table


Answer by: Janhu
Posted: Jun 8, 2016