function mymodule_tapir_table_alter(&$table, $table_id) {
  if ($table_id != 'uc_cart_view_table') return;
  
  // Register new column to tapir
  $table['#columns']['price_item'] = array(
    'cell' => t('Price'),
    'weight' => 2.5,
  );
  
  foreach (element_children($table) as $key) {
    if (empty($table[$key]['nid']['#value'])) continue;
      
      // This db-expensive node_load call can be easily avoided by using 
      // single SQL select. But, 
      // that's not so important if visitor usually adds 1-5 products to cart.
      $n = node_load($table[$key]['nid']['#value']);
      $p = uc_price($n -> sell_price, array());     // Add data to our new column
      $table[$key]['price_item'] = array(
         '#value' => $p, 
         '#cell_attributes' => array('class' =>'price-item')
      );   
  }
}

The above code not working for custom category with respect to product.

How i will add new table column for category ?

Please Help me.

Comments

girishpanchal created an issue. See original summary.

TR’s picture

Assigned: girishpanchal07 » Unassigned
Category: Task » Support request
Issue tags: -Ubercart
TR’s picture

Status: Active » Fixed

That appears to be a piece of code written for Drupal 6.

Drupal 7 uses "#markup" instead of "#value" in the render array.

girishpanchal07’s picture

Issue summary: View changes
TR’s picture

Why did you delete your post? Did my advice help? Regardless, you should 1) respond to my comments, and 2) leave the post visible so that other people who might have the same issue can see the responses and benefit from them.

I will restore the original post ...

TR’s picture

Issue summary: View changes

Restored original issue summary.

Status: Fixed » Closed (fixed)

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