Hello,

I having some trouble with displaying total cost column on the cart page. I have added the unit cost price column in the cart page through custom module which is perfectly fine. Now i want to show one more column which will calculate the total cost price according to quantity. Eg quantity * cost price = total price

Please help
this is the coding i have used soo far in the custom cost price column

function custom_form_uc_cart_view_form_alter(&$form, &$form_state) {

$form['items']['#columns']['price'] = array(
'cell' => t('Unit Cost'),
'weight' => 3.5,
);

}
function custom_tapir_table_alter(&$table, $table_id) {

if ($table_id == 'uc_cart_view_table') {
foreach (element_children($table) as $key) {
if (!empty($table['#parameters'][1][$key]['nid'])) {
$node = node_load($table['#parameters'][1][$key]['nid']['#value']);
$table[$key]['price'] = array(
'#markup' => theme('uc_product_price',array('element' => array('#value' => $node->cost))),

);

}
}
}
}

Any help would be appreciated

Comments

TR’s picture

Assigned: vivek005 » Unassigned
Category: Task » Support request
Status: Active » Fixed

As per the posting instructions, we don't use this issue queue to help people debug custom code. Besides, you just posted the code that works, not the code that doesn't work, so I don't know what you expect. Since you have one piece of code that works it should be an easy matter to add another column. If you need some coding help, try the drupal forums on IRC.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.