drupalubercartdrupal-5drupal-hooks

Values from Drupal's hook_order "new"


In Drupal's hook_order function, I was wondering if anyone can tell me how I could find the values of $arg when the case is "new"? The resulting print_r always show up blank for any checkout value such as "billing_first_name" or "billing_last_name" when I try to print $arg out (print_r($arg)) despite having actual values. I have a custom module that is trying to grab the values from $order - would I switch &$arg1 to &$order to retrieve the values? When there is a "case 'load'", I get the $order values as I need, but I need the code within the case to be done only when the order is completed, not before.

hook_order($op, &$arg1, $arg2){
 switch($op){
    case 'new':
       // when I do print_r(&$arg1), the value shows the order_id and uid, 
       // but billing_first_name or any inputted value through 
       // the checkout form is blank
       break;
  }
}

Solution

  • For those interested, I came up with this:

    hook_order($op, &$arg1, $arg2){
      switch($op){
         case 'update':
            if($arg2 == "pending") {
            //code here
            }
          break;
       }
      }
    

    Might not be perfect but works close enough.