Attached is a patch I created to add hook_product_alter. I created this out of the necessity to access properties of products right at the point that uc_product interacts with these properties, and if the community finds it helpful enough, hopefully it could be included into ubercart.

hook_uc_product_alter($op, &$arg1)

$op:

* validate
* insert
* update
* load

$arg1:

for "load" returns $product object
all others returns $node object

CommentFileSizeAuthor
uc_product_alter.patch3.14 KBcangeceiro

Comments

cangeceiro’s picture

Status: Patch (to be ported) » Needs review

oops, boogered the patch

rszrama’s picture

Status: Needs review » Needs work

As far as I know, alteration hooks are really only used for altering data bits when an entity is loaded. Drupal is also moving away from $op oriented hooks. I could possibly see putting a drupal_alter() in the uc_product_load() function, but doing it again in the saving functions isn't the right place.

Since this won't represent an API change, I'd still be comfortable considering this for inclusion after we get 2.0 out... will let Lyle concur.

longwave’s picture

Status: Needs work » Closed (won't fix)

Nothing here that can't be done with hook_nodeapi as far as I can tell.