I get this error when my Feed Importer has any of the UCA: Cost, UCA: Price, or UCA: Weight targets for sources in the csv file.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '832-2' for key 1: INSERT INTO {uc_product_options} (nid, oid, cost, price, weight, ordering) 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); Array ( [:db_insert_placeholder_0] => 832 [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 60.6 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => -48 ) in uc_feeds_node_insert() (line 154 of /home2/partyfav/public_html/sites/all/modules/uc_feeds/uc_feeds.module).

Drupal core 7.22
Feeds 7.x-2.0-alpha8
ubercart 7.x-3.5
uc_feeds 7.x-1.0

Comments

jpdaut’s picture

Nobody else is getting this error? Hard to believe.

Does this module work for you?

dubs’s picture

It looks like there is already an option 2 for that particular node and that's the issue - it's trying to add another option with the same value against that node. Maybe try removing the options from that node before you import.

The Feeds mapper only maps values to arrays and there isn't very much else in there. Take a look through the code at the part where the attributes options are mapped and maybe you could add a check to see if an option already exists. If you do, I'd be happy to commit a patch.

jpdaut’s picture

Thanks. What you said gave me a hint: I had attributes in my UC product class in admin/store/products/classes, which I removed. Then I imported again, same import file with the UC Attributes as before, and it went fine.

So I'm not sure if this is a bug in UC Feed Mappers in the end.

Although it would seem that you should be able to build a full product class w/Attributes upfront, per Ubercart guidelines, and still use UC Feed Mappers later, successfully.

But I have a workaround now. Thanks.

hanoii’s picture

Issue summary: View changes

I am currently cleaning up/improving D7 version of the module, I am improting products with attributes just fine, not sure why you saw this issue in the first place, can you remind me what was it that you were trying to do. Was it creating products, or was it update or anything? I do not think this module currently supports updating though yet.

hanoii’s picture

Status: Active » Closed (duplicate)
Related issues: +#2185057: Support Existing Product Class Attributes

After reading #2185057: Support Existing Product Class Attributes I understood the issue. Should be fixed now though.