Re: uc_product_table is only

Posts: 68
Joined: 11/26/2007

Thanks for the help. It's closer, but still not quite working. I've emptied the cart, cleared the cache, and refilled the cart, and the new column is showing, but it's not putting any data in there.

I'm attaching two screenshots -- one showing the cart with the "model" column, but it's blank, and a second one showing the uc_cart_view_table admin page. I'm not sure where that blank row is coming from.

And here's my updated module_table_alter code:

function myModule_table_alter($table_id, $op, $args = null) {
  if($table_id == 'uc_cart_view_table') {
    switch ($op){
     case 'fields':
       $fields[] = array('name' => 'model',
         'title' => t('SKU'),
         'weight' => 1,
         'enabled' => true,
       );
     return $fields;
      case 'data':
      $obj = new stdClass();
      foreach ($args['#parameters'][1] as $nid) {
        $obj->vid = $nid;
        $prod = uc_product_load($obj);
        $data['model'][] = $prod->model;
      }
      return $data;
}
  }
}

AttachmentSize
uc_cart_table_admin.jpg22.97 KB
uc_cart.jpg16.99 KB
add SKU to cart? By: sprugman (17 replies) Thu, 01/03/2008 - 18:35