【发布时间】:2015-02-22 14:53:20
【问题描述】:
当我以管理员身份转到admin/store/orders/50457/invoice 时,我看到以下内容:
注意它有一个“免费订单”的付款方式,底部的总金额是 0.00 美元。
当我以非管理员身份访问同一页面时,我看到以下内容: 请注意付款方式为空,订单总额为 8.21 美元。
正确的是管理员看到的,那么到底是怎么回事导致两者的行为不同?
编辑:事实证明,在我(很久以前)创建的一个名为 tf_store_credit.module 的模块中,我有以下内容:
function tf_store_credit_line_item(){
global $user;
$total_credit= uc_store_credit_f_get_user_credit($user->uid);
if ($total_credit>0){
$items[] = array
(
'id' => 'store-credit', // You will use this ID in the javascript
'title' => t('Store Credit'), // This is the text that will be displayed on the line item in the subtotal
'callback' => 'tf_store_credit_line_item_callback', // This is the callback function
'stored' => TRUE,
'default' => FALSE,
'calculated' => TRUE,
'display_only' => FALSE,
'weight' => 15,
);
}
return $items;
}
问题在于它获取的是当前登录用户的商店信用,而不是下订单的用户。那么我该如何获得正确的用户呢?
【问题讨论】: