Hiya,

I added a product attribute to a product then removed it. Decided it should have those attributes again and added it. The addition resulted in error messages like:

user warning: Duplicate entry '13-3' for key 1 query: INSERT INTO uc_product_options (nid, oid, cost, price, weight, ordering) VALUES (13, 3, 0, 0, 0, -10) in /srv/drupal-6/sites/all/modules/ubercart/uc_attribute/uc_attribute.admin.inc on line 626.

I'm guessing those records aren't removed so sold products and adjustments aren't compromised. So I suppose it's just the insertion code needs to check if those records exist already before doing the insert.

Posting it here in case someone else gets a chance to fix it before I do.

CommentFileSizeAuthor
#2 delete_attributes_options.patch1.41 KBIsland Usurper

Comments

nchase’s picture

getting something same when I add attributes, especiall when adding more than one:

user warning: in ubercart/uc_attribute/uc_attribute.admin.inc on line 626.

Island Usurper’s picture

Status: Active » Fixed
StatusFileSize
new1.41 KB

Arg. The queries that delete the options and the attribute have the values in different orders, and the attribute and node ids are almost never the same. Patch rearranges the arguments given to db_query() for those two DELETE statements.

Committed to repo, since it tested fine on my local sites.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.