The Date (Commerce Order) filter does not work when using aggregation with line item as base table.

Using the filter throws a

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'commerce_order.created' in 'where clause'

Exported view:

<?php
$view = new view();
$view->name = 'test';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'commerce_line_item';
$view->human_name = 'Test';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Test';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['use_more_text'] = 'mer';
$handler->display->display_options['group_by'] = TRUE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'Bruk';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Nullstill';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Sortér på';
$handler->display->display_options['exposed_form']['options']['sort_asc_label'] = 'Stigende';
$handler->display->display_options['exposed_form']['options']['sort_desc_label'] = 'Synkende';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = 'Elementer per side';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all_label'] = '- Alle -';
$handler->display->display_options['pager']['options']['tags']['first'] = '« første';
$handler->display->display_options['pager']['options']['tags']['previous'] = '‹ forrige';
$handler->display->display_options['pager']['options']['tags']['next'] = 'neste ›';
$handler->display->display_options['pager']['options']['tags']['last'] = 'siste »';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relasjon: Commerce Line Item: Ordre ID */
$handler->display->display_options['relationships']['order_id']['id'] = 'order_id';
$handler->display->display_options['relationships']['order_id']['table'] = 'commerce_line_item';
$handler->display->display_options['relationships']['order_id']['field'] = 'order_id';
$handler->display->display_options['relationships']['order_id']['required'] = TRUE;
/* Felt: Commerce Line Item: Ordrelinje ID */
$handler->display->display_options['fields']['line_item_id']['id'] = 'line_item_id';
$handler->display->display_options['fields']['line_item_id']['table'] = 'commerce_line_item';
$handler->display->display_options['fields']['line_item_id']['field'] = 'line_item_id';
/* Filter criterion: Dato: Date (commerce_order) */
$handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
$handler->display->display_options['filters']['date_filter']['table'] = 'commerce_order';
$handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
$handler->display->display_options['filters']['date_filter']['relationship'] = 'order_id';
$handler->display->display_options['filters']['date_filter']['operator'] = 'between';
$handler->display->display_options['filters']['date_filter']['exposed'] = TRUE;
$handler->display->display_options['filters']['date_filter']['expose']['operator_id'] = 'date_filter_op';
$handler->display->display_options['filters']['date_filter']['expose']['label'] = 'Date (commerce_order)';
$handler->display->display_options['filters']['date_filter']['expose']['operator'] = 'date_filter_op';
$handler->display->display_options['filters']['date_filter']['expose']['identifier'] = 'date_filter';
$handler->display->display_options['filters']['date_filter']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
  4 => 0,
  3 => 0,
  7 => 0,
);
$handler->display->display_options['filters']['date_filter']['form_type'] = 'date_popup';
$handler->display->display_options['filters']['date_filter']['date_fields'] = array(
  'commerce_order.created' => 'commerce_order.created',
  'commerce_order.changed' => 'commerce_order.changed',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'test';
$translatables['test'] = array(
  t('Master'),
  t('Test'),
  t('mer'),
  t('Bruk'),
  t('Nullstill'),
  t('Sortér på'),
  t('Stigende'),
  t('Synkende'),
  t('Elementer per side'),
  t('- Alle -'),
  t('Offset'),
  t('« første'),
  t('‹ forrige'),
  t('neste ›'),
  t('siste »'),
  t('Ordre'),
  t('Ordrelinje ID'),
  t('Page'),
);
?>

Comments

rszrama’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

I don't know where this filter is coming from; when I try to import your View, it says that filter doesn't exist, and if I look at the list of filters to add to an Order View, it only shows the "Created date" filter, not "Date." Are you sure this isn't a problem with a third party module?

farald’s picture

Project: Commerce Core » Date
Component: Views integration » Views Filter
Status: Postponed (maintainer needs more info) » Active

Mm you're right, it's definetly not Commerce core.
The filters are from the date_views module, used by commerce_backoffice.

farald’s picture

Issue summary: View changes

Styling