1

I am suffering from a bug in Views 7.x-3.11 detailed here in relation to filter groups. Views incorrectly adds INNER JOINs when LEFT joins would be correct.

I am trying to alter the $query object using the code ( this approach is not based on any documentation, but simply a guess ):

function mymodule_views_query_alter(&$view, &$query) {
  if($view->name == 'my-view' && $view->current_display == 'my-display') {
    $query->table_queue['field_data_field_listing_type']['join']->type = 'LEFT';
  }
}

However this change causes the View to generate an ajax error "Fatal error: Call to undefined method stdClass::build_join in sites/all/modules/views/plugin/views_plugin_query_default.inc on line 1313".

Any assistance?

1

Complete operator error. For the benefit of anyone else who encounters this error check your fieldname. In my case I had misspelt the fieldname ['field_data_field_listing_type'] so it was generating a new incompleted entry in the table_queue array.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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