Need help with drupal, ubercart and module hook when loading the product

I am trying to create a module that works with ubercart. I need to know how I can connect to the product download. I want to change some data a bit before any exit. thank

+3
source share
1 answer

Use hook_nodeapi and the $ op download view to add / change data.

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

This function runs when node loads. What you want to do is:

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

Try it. This should dump the node object if node is a product, and you can see how to add / modify data in the node object from there.

+2
source

Source: https://habr.com/ru/post/1749834/


All Articles