I am just trying to remove the "cost" column from the oder view page at for example www.mysite.com/admin/store/orders/[order-number].
The table function responsible for outputting the cost column is:
/**
* Builds the order view products table.
*/
function uc_op_products_view_table($order) {
$table = array(
'#type' => 'tapir_table',
'#attributes' => array('class' => array('order-pane-table')),
);
$table['#columns']['qty'] = array(
'cell' => array(
'data' => theme('uc_qty_label'),
'class' => array('qty'),
),
'weight' => 0,
);
$table['#columns']['product'] = array(
'cell' => array(
'data' => t('Product'),
'class' => array('product'),
),
'weight' => 1,
);
$table['#columns']['model'] = array(
'cell' => array(
'data' => t('SKU'),
'class' => array('sku'),
),
'weight' => 2,
);
if (user_access('administer products')) {
$table['#columns']['cost'] = array(
'cell' => array(
'data' => t('Cost'),
'class' => array('cost'),
),
'weight' => 3,
);
}
$table['#columns']['price'] = array(
'cell' => array(
'data' => t('Price'),
'class' => array('price'),
),
'weight' => 4,
);
$table['#columns']['total'] = array(
'cell' => array(
'data' => t('Total'),
'class' => array('total'),
),
'weight' => 5,
);
if (!empty($order->products)) {
$build = uc_order_product_view_multiple($order->products);
$table['#rows'] = $build['uc_order_product'];
}
else {
$table['#rows'][]['product'] = array(
'#markup' => t('This order contains no products.'),
'#cell_attributes' => array('colspan' => 'full'),
);
}
return $table;
}
located on line 1058 in uc_order.order_pane.inc which can be found in mysite/sites/all/modules/ubercart/uc_order/uc_order.order_pane.inc.
I took a look at http://www.ubercart.org/docs/developer/7512/tapir_tables_api and wrote this code inside my template.php file inside my theme but it did not change
function my_theme_tapir_table_alter(&$table, $table_id) {
if ($table_id == 'uc_op_products_view_table') {
$table['#columns']['cost']['access'] = FALSE;
}
}
I saved, cleared cache, run cron and yet no changes. the "cost" column still appears on the page. Any help?
Comments
Comment #1
docans CreditAttribution: docans commentedComment #2
TR CreditAttribution: TR commentedAgain, please read the issue guidelines, specifically for the "priority" field: https://drupal.org/node/45111
Also, this issue queue is not for help debugging your custom code.
There are several threads on ubercart.org with examples of how to use hook_tapir_table_alter(). You should read those and ask in those threads if you have trouble implementing that advice.