Problem:
When drupal commerce application does not have any product displays defined (Content types), Backoffice content view brakes because of is_product_display filter defined in product_reference:

filter returnes:
// WHERE (( (node.type NOT IN ()) ))
fix would be:
// WHERE (( (node.type NOT IN ('')) ))

cheers

Comments

rszrama’s picture

Project: Commerce Core » Commerce Backoffice
Component: Views integration » Code
primozsusa’s picture

the code that needs the fix is not in backoffice

rszrama’s picture

Project: Commerce Backoffice » Commerce Core
Component: Code » Product reference
Status: Active » Needs review

Ahh, ok.

damien tournoud’s picture

This probably should be something like:

if ($node_types) {
  $this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field", $node_types, $this->value ? 'IN' : 'NOT IN');
}
else {
  // No product types are defined, so no row can match (in the IN case) or all rows match (in the NOT IN case).
  if ($this->value) {
    $this->query->add_where_expression($this->options['group'], '1 = 0');
  }
}
mglaman’s picture

Status: Needs review » Reviewed & tested by the community

Patch applies, does as expected. This unblocks me from using Backoffice in an invoicing SaaS I'm developing. Line items are generated off of Time Tracker entities and it does not utilize Product entities.

I did give #4 a shot before patch, but that suggestion did not work.

rszrama’s picture

rszrama’s picture

Status: Reviewed & tested by the community » Fixed

Works for me. Committed.

  • rszrama committed 61b104d on 7.x-1.x authored by primozsusa
    Issue #2178989 by primozsusa: fix the Is Product Display Views filter...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.