Hi guys,
When I try to add one times two products with the same SKU form to allow me (not validation unique SKUs) and after updating node comes an error message.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Test-SKU-1' for key 'sku': INSERT INTO {commerce_product} (revision_id, sku, title, type, language, uid, status, created, changed) 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] => [:db_insert_placeholder_1] => Test-SKU-1 [:db_insert_placeholder_2] => Test-SKU [:db_insert_placeholder_3] => modifikacia_vahy [:db_insert_placeholder_4] => sk [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1 [:db_insert_placeholder_7] => 1359709875 [:db_insert_placeholder_8] => 1359709875 ) v drupal_write_record() (riadok 7036 z /data/web/coolstranky.sk/sub/devlibrashop/includes/common.inc).
I think the solution would certainly be to add validation after update product in "class CommerceProductInlineEntityFormController" > "public function entityFormValidate" ?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | commerce_product_sku_validation-1905170-3.patch | 1.29 KB | fox mulder |
| #1 | commerce_product_sku_validation-1905170-1.patch | 1.16 KB | vasike |
| inline-entity-form-bug.gif | 12.75 KB | frankye |
Comments
Comment #1
vasikeindeed. ugly one when it happens.
so there's should be an extra check against data entered for product in the IEF.
here is a patch that should solve this.
Comment #2
fox mulder commentedIt does not work because it validates out existing sku-s. Sorry, but I can not create a patch yet. I think this is the right solution
Comment #3
fox mulder commented$entity['entity']->product_id and $product->product_id can be NULL, this is better:
Comment #5
paulbeaney commentedThe patch from #3 works great for me.
Comment #6
bluegeek9 commentedWe appreciate your contributions to Inline Entity Form. Drupal 7 in End-of-Life. We encourage you to upgrade to a supported version of Drupal.