0

So, I have serialized data within the uc_orders table. This data has several parameters of interest each of which I want to create a unique field from.

Each one of these $data values work on their own. Obviously I am rewriting the value on the second declaration. How can I reference the same data location twice so that both of the fields can be used and I can explode all of my serialized data into separate fields?

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

1 Answer 1

0

I finally found the answer.


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

The solution is to add 'real field' => 'field name', and change the $data id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.