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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cha0s’s picture

Lyle, is there a reason we aren't node_save()ing here?

rszrama’s picture

Issue tags: +ubercamp sprint
Island Usurper’s picture

The 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.

Island Usurper’s picture

Status: Active » Closed (duplicate)

Duplicate 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.

longwave’s picture

Version: 6.x-2.0-rc3 » 6.x-2.x-dev
Status: Closed (duplicate) » Needs review
Issue tags: -ubercamp sprint
FileSize
2.13 KB

Reopening, with a patch to use node_save() instead, and some extra code in uc_product_kit_update() to handle this case.

longwave’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)

This is working well for me in testing, so I've committed it. Needs porting to 7.x.

TR’s picture

Component: Code » Product kits

Moving to "Product kit" component.

Island Usurper’s picture

Status: Patch (to be ported) » Needs review
FileSize
2.88 KB

I 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.

longwave’s picture

#8: 473572_update_kits.patch queued for re-testing.

longwave’s picture

#8: 473572_update_kits.patch queued for re-testing.

longwave’s picture

Status: Needs review » Fixed

Committed #8

Status: Fixed » Closed (fixed)

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