Posted by AdamGerthel on December 14, 2012 at 12:21pm
2 followers
| Project: | Drupal Commerce |
| Version: | 7.x-1.4 |
| Component: | Order |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (cannot reproduce) |
Issue Summary
I'm having trouble adding a product to an order, on the order editing page. When adding a product I'm getting the following error (in js alert box)
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: error
ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '28610' for key 'PRIMARY': INSERT INTO {commerce_line_item} (line_item_id, order_id, type, line_item_label, quantity, created, changed, 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); Array
(
[:db_insert_placeholder_0] => 28610
[:db_insert_placeholder_1] => 9963
[:db_insert_placeholder_2] => product
[:db_insert_placeholder_3] => 101976
[:db_insert_placeholder_4] => 1
[:db_insert_placeholder_5] => 1355487394
[:db_insert_placeholder_6] => 1355487394
[:db_insert_placeholder_7] => a:0:{}
)
in drupal_write_record() (line 7106 of /path-to-site/includes/common.inc).A table row is created in commerce_line_item but that's it.
I tried upgrading DC from 1.3 to 1.4 but that didn't help. Drupal was running on 7.14 but is now running 7.17 also to no avail.
Comments
#1
Did you previously manually remove items from the commerce_line_item table or reset its auto increment value? Are you using Inline Entity Form here?
#2
Hmm, we've manually added line items via the database a couple of times to circumvent this problem until we manage to fix it (not ideal I know). It's possible that a line item has been manually removed at some point. The site was released in september last year when Commerce was very young, so there were some problems in the beginning. I'm not sure about the auto increment value though - where and what is that?
We're not using inline entity form (isn't that just for creating products on product display nodes?)
#3
IEF has been expanded to support the order edit form / line item reference field, but no worries - was just trying to rule it out. The auto_increment is just part of the metadata for the table. You should be able to find it if you go to the operations tab for the table in phpMyAdmin.
#4
The auto-increment seems to be working (see attached screenshot). It looks like it tries to create two rows. The "data" columns is empty
#5
Any other idea on what could be the problem?
#6
Not really, and without being able to reproduce the issue I'm not sure what else I can suggest. For some reason your site is trying to INSERT a new line item into the table that it has just INSERTed, except the second time around it actually has a value for the line_item_id. That can be happening because of a custom module or custom Rule, but there's nothing in a default implementation of Commerce that should make it do so. In local testing I have no problems adding new line items to orders. Hope you got it sorted out since then.