来自 Drupal 的 hook_order “new” 的值
在Drupal的hook_order函数中,我想知道是否有人可以告诉我当case是“new”时如何找到$arg的值?当我尝试打印 $arg 输出 (print_r($arg)) 时,尽管有实际值,但对于任何结帐值(例如“billing_first_name”或“billing_last_name”),生成的 print_r 始终显示为空白。我有一个自定义模块试图从 $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;
}
}
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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于那些感兴趣的人,我想出了这个:
可能并不完美,但工作得足够接近。
For those interested, I came up with this:
Might not be perfect but works close enough.