1

所以,我已经序列化了 uc_orders 表中的数据。这个数据有几个感兴趣的参数,我想从中创建一个唯一的字段。

这些 $data 值中的每一个都独立工作。显然我正在重写第二个声明的值。如何两次引用相同的数据位置,以便可以使用两个字段,并且可以将所有序列化数据分解为单独的字段?

  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',
      ),
    );
  }
4

1 回答 1

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',和更改 $data id。

于 2012-06-18T20:26:28.033 回答