Order product ID field returns "0" in Views I have a View of type "Orders" for my Ubercart orders. I am trying to display the "Order Product ID" field value for each order product so that I can count those as distinct. I added the relationship "Order: Products", which makes the "Order Product ID" field available; however, that field is returning a value of "0" instead of the actual Order Product ID displayed in the database. How can I resolve this?

Here is an export of my view:

$view = new view();
$view-&gt;name = 'order_test';
$view-&gt;description = '';
$view-&gt;tag = 'default';
$view-&gt;base_table = 'uc_orders';
$view-&gt;human_name = 'Order Test';
$view-&gt;core = 7;
$view-&gt;api_version = '3.0';
$view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view-&gt;new_display('default', 'Master', 'default');
$handler-&gt;display-&gt;display_options['use_more_always'] = FALSE;
$handler-&gt;display-&gt;display_options['access']['type'] = 'none';
$handler-&gt;display-&gt;display_options['cache']['type'] = 'none';
$handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';
$handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';
$handler-&gt;display-&gt;display_options['pager']['type'] = 'full';
$handler-&gt;display-&gt;display_options['style_plugin'] = 'default';
$handler-&gt;display-&gt;display_options['row_plugin'] = 'fields';
/* Relationship: Order: Products */
$handler-&gt;display-&gt;display_options['relationships']['products']['id'] = 'products';
$handler-&gt;display-&gt;display_options['relationships']['products']['table'] = 'uc_orders';
$handler-&gt;display-&gt;display_options['relationships']['products']['field'] = 'products';
/* Field: Order: Order ID */
$handler-&gt;display-&gt;display_options['fields']['order_id']['id'] = 'order_id';
$handler-&gt;display-&gt;display_options['fields']['order_id']['table'] = 'uc_orders';
$handler-&gt;display-&gt;display_options['fields']['order_id']['field'] = 'order_id';
/* Field: Ordered product: Order product ID */
$handler-&gt;display-&gt;display_options['fields']['order_product_id']['id'] = 'order_product_id';
$handler-&gt;display-&gt;display_options['fields']['order_product_id']['table'] = 'uc_order_products';
$handler-&gt;display-&gt;display_options['fields']['order_product_id']['field'] = 'order_product_id';
$handler-&gt;display-&gt;display_options['fields']['order_product_id']['relationship'] = 'products';
$handler-&gt;display-&gt;display_options['fields']['order_product_id']['link_to_entity'] = 0;


Thanks!
I've also experienced this issue by creating hook_views_data_alter adding  the following code into it:

$data['uc_order_products']['order_product_id']['field'] = array(
    'handler' =&gt; 'views_handler_field_numeric',
);


I have noticed that the order_product_id had no handler so since the return of this field is the ordered product id I just went ahead and used the handler that comes with Views views_handler_field_numeric.

If you'd like, I bunched some additions related to the order product id field in my custom module in Ubercart-Add-ons.