FYI: there's a core bug with drupal_execute that means trouble with uc_product_kit_nodeapi's use of it: #260934: Static caching: when drupal_execute()ing multiple forms with same $form_id in a page request, only the first one is validated
To reproduce:
Add a CCK text options widget (radio fields) to product kit content type.
Create two product kits which both include product foo.
Update product foo.
One of the product kits will have its CCK option value cropped down to 1 character.
Currently drupal_execute is broken if you use it more than once at a time. Might be better to switch to node_save.
Comment | File | Size | Author |
---|---|---|---|
#8 | 473572_update_kits.patch | 2.88 KB | Island Usurper |
#5 | uc_product_kit-nodeapi-sync.patch | 2.13 KB | longwave |
Comments
Comment #1
cha0s CreditAttribution: cha0s commentedLyle, is there a reason we aren't node_save()ing here?
Comment #2
rszrama CreditAttribution: rszrama commentedComment #3
Island Usurper CreditAttribution: Island Usurper commentedThe reason node_save() doesn't work is because hook_update() doesn't actually take a $node object. It takes the form values, which have been turned into an object that is almost like a node. Usually this is OK because most node forms map very easily to the node's structure. Product kits don't. Using drupal_execute() was the easiest way around it.
Comment #4
Island Usurper CreditAttribution: Island Usurper commentedDuplicate of the core issue. I tried fixing the way Ubercart handled it, but I didn't get anywhere. If anyone else wants to try, they can reopen the issue.
Comment #5
longwaveReopening, with a patch to use node_save() instead, and some extra code in uc_product_kit_update() to handle this case.
Comment #6
longwaveThis is working well for me in testing, so I've committed it. Needs porting to 7.x.
Comment #7
TR CreditAttribution: TR commentedMoving to "Product kit" component.
Comment #8
Island Usurper CreditAttribution: Island Usurper commentedI had to make some changes to uc_product_kit_update() to keep the qty and discount settings on the kit. I was going to test it on Drupal 6, but I got a ridiculous 416 Range not satisfiable error on the create product kit page.
Comment #9
longwave#8: 473572_update_kits.patch queued for re-testing.
Comment #10
longwave#8: 473572_update_kits.patch queued for re-testing.
Comment #11
longwaveCommitted #8