You are here

uc_coupon_handler_argument_product_type.inc in Ubercart Discount Coupons 7.3

Same filename and directory in other branches
  1. 7.2 views/uc_coupon_handler_argument_product_type.inc

Views handler: Coupon filter on "product-type".

File

views/uc_coupon_handler_argument_product_type.inc
View source
<?php

/**
 * @file
 * Views handler: Coupon filter on "product-type".
 */

/**
 * Filter coupons based on what product types they apply to
 */
class uc_coupon_handler_argument_product_type extends views_handler_argument {
  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 " : "")
  }

}

Classes

Namesort descending Description
uc_coupon_handler_argument_product_type Filter coupons based on what product types they apply to