1

在 Drupal 的 hook_order 函数中,我想知道是否有人可以告诉我当案例为“新”时如何找到 $arg 的值?当我尝试打印 $arg (print_r($arg)) 尽管有实际值时,生成的 print_r 对于任何结帐值(例如“billing_first_name”或“billing_last_name”)始终显示为空白。我有一个自定义模块试图从 $order 中获取值 - 我会将 &$arg1 切换到 &$order 以检索值吗?当有“案例'加载'”时,我会根据需要获得 $order 值,但我需要仅在订单完成时才完成案例中的代码,而不是之前。

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;
  }
}
4

1 回答 1

0

对于那些感兴趣的人,我想出了这个:

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

可能不完美,但足够接近。

于 2011-08-05T18:37:14.867 回答