Php 如何在Ubercart 3中自定义发票页面
我需要自定义用户在url上看到的页面:user/%user/orders/%uc\u order 我试着用钩子盘Php 如何在Ubercart 3中自定义发票页面,php,drupal,drupal-7,ubercart,Php,Drupal,Drupal 7,Ubercart,我需要自定义用户在url上看到的页面:user/%user/orders/%uc\u order 我试着用钩子盘 function mymodule_uc_order_pane() { $panes['ship_to_xx'] = array( 'callback' => 'mymodule_uc_order_pane_ship_to_xx', 'title' => t('Just a Test'), 'desc' => t("Description!!"),
function mymodule_uc_order_pane() {
$panes['ship_to_xx'] = array(
'callback' => 'mymodule_uc_order_pane_ship_to_xx',
'title' => t('Just a Test'),
'desc' => t("Description!!"),
'class' => 'pos-left',
'weight' => 99,
'show' => array('view', 'edit', 'invoice', 'customer'),
);
return $panes;
}
并清除了所有缓存,但这不起作用。它没有显示任何内容。
你有什么建议吗?代码没有错。
正确的方法是:
function mymodule_uc_order_pane() {
$panes['mm_links'] = array(
'callback' => 'mymodule_uc_order_pane_links',
'title' => t('Just a Test'),
'desc' => t("Description!!"),
'class' => 'pos-left',
'weight' => 99,
'show' => array('customer'),
);
return $panes;
}
function mymodule_uc_order_pane_links($op,$order){
$html='';
foreach($order->products as $product){
$node = node_load($product->nid);
$html.='Date: '.$product->data['attributes']['Tour Date'][0].'<br/>';
$html.='Parent ID: '.$node->field_tour['und'][0]['nid'].'<br/>';
}
return ($html);
}
我想你会发现更好的是在mymodule\u uc\u order\u pane\u链接中使用switch$op更幸运。在这种情况下,$op可能是窗格主体的“客户”,“显示标题”,true或false显示标题,以及“查看标题”定义标题内容。使用Drupal的主题函数也比编写原始HTML更好。i、 e:$build=array'markup'=>$html;返回$build;