You are here

function uc_coupon_handler_argument_product_type::query in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 7.2 views/uc_coupon_handler_argument_product_type.inc \uc_coupon_handler_argument_product_type::query()

Set up the query for this argument.

The argument sent may be found at $this->argument.

Parameters

bool $group_by: Whether the query uses a group-by.

Overrides views_handler_argument::query

File

views/uc_coupon_handler_argument_product_type.inc, line 12
Views handler: Coupon filter on "product-type".

Class

uc_coupon_handler_argument_product_type
Filter coupons based on what product types they apply to

Code

function query() {
  $this
    ->ensure_my_table();
  $this->query
    ->add_field('uc_coupons', 'data');
  if (!empty($this->argument)) {
    $regexp = '.*product_types.*{[^}]*(' . $this->argument . ').*}';
    $this->query
      ->add_where_expression(0, 'uc_coupons.data ' . 'REGEXP :re', array(
      ':re' => $regexp,
    ));
  }

  //. ($this->options['operator'] !== 'in' ? "NOT " : "")
}