2012-06-16 71 views
1

所以,我已經在uc_orders表中序列化了數據。這些數據有幾個我感興趣的參數,我想從中創建一個獨特的字段。查看數據庫列中的字段

這些$數據值中的每一個都是獨立工作的。顯然我正在重寫第二個聲明的價值。如何兩次引用相同的數據位置,以便可以使用這兩個字段,並且可以將所有序列化數據分解爲單獨的字段?

function uc_order_views_data() { 
    $data['uc_orders']['data'] = array(
     'group' => t('Order') . ':data', 
     'title' => t('Arrival Date'), 
     'help' => t('Arrival date choosen by customer during checkout.'), 
     'field' => array(
     'handler' =>'uc_order_handler_field_arrive_date', 
     'click sortable' => TRUE, 
    ), 
     'sort' => array(
     'handler' => 'views_handler_sort', 
    ), 
     'filter' => array(
     'handler' => 'views_handler_filter_string', 
    ), 
    ); 

    $data['uc_orders']['data'] = array(
     'group' => t('Order') . ':data', 
     'title' => t('Ship Date'), 
     'help' => t('The date to ship the order by.'), 
     'field' => array(
     'handler' =>'uc_order_handler_field_ship_date', 
     'click sortable' => TRUE, 
    ), 
     'sort' => array(
     'handler' => 'views_handler_sort', 
    ), 
     'filter' => array(
     'handler' => 'views_handler_filter_string', 
    ), 
    ); 
    } 

回答

2

我終於找到了答案。

$data['uc_orders']['data2'] = array(
    'group' => t('Order') . ':data', 
    'title' => t('Arrival Date'), 
    'real field' => 'data', 
    'help' => t('Arrival date choosen by customer during checkout.'), 
    'field' => array(
    'handler' =>'uc_order_handler_field_arrive_date', 
     'click sortable' => TRUE, 
    ), 
    'sort' => array(
     'handler' => 'views_handler_sort', 
    ), 
    'filter' => array(
     'handler' => 'views_handler_filter_string', 
    ), 
); 

    $data['uc_orders']['data'] = array(
    'group' => t('Order') . ':data', 
    'title' => t('Ship Date'), 
    'help' => t('The date to ship the order.'), 
    'field' => array(
    'handler' =>'uc_order_handler_field_ship_date', 
     'click sortable' => TRUE, 
    ), 
    'sort' => array(
     'handler' => 'views_handler_sort', 
    ), 
    'filter' => array(
     'handler' => 'views_handler_filter_string', 
    ), 
); 

的解決方案是增加'real field' => 'field name',和更改$數據ID。