开发者

Need help with drupal, ubercart and a module hook on product load

I am trying to make a module that works with ubercart. What I need to know is how do I hook into the loading of a product. I want to modify some of the d开发者_如何学Pythonata slightly before any output. Thanks


Use hook_nodeapi and the load view $op to add/alter data.

http://api.drupal.org/api/function/hook_nodeapi

This function is fired when a node is being loaded. What you will want to do is:

mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   switch ($op) {
      case 'load':
        if ($node->type == 'product') {
            var_dump($node);
        }
   }
}

Try that out. That should dump the node object if the node is a product, and you can see how to add/alter data in the node object from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜