Example #1
0
 function initQuery($params)
 {
     $cost_type_id = $params['cost_type_id'];
     $b_active_only = $params['b_active_only'];
     $current_customer_group = $params['current_customer_group'];
     $tables = Quantity_Discounts::getTables();
     $tr = $tables['quantity_discounts_rates_table']['columns'];
     $this->addSelectField($tr["id"], "id");
     $this->addSelectField($tr["product_id"], "product_id");
     $this->addSelectField($tr["rv_from"], "rv_from");
     $this->addSelectField($tr["cost_type_id"], "cost_type_id");
     $this->addSelectField($tr["b_active"], "b_active");
     $this->addSelectField($tr["cost"], "cost");
     $this->addSelectField($tr["customer_group_id"], "customer_group_id");
     $this->WhereValue('', '', '1');
     if ($cost_type_id !== NULL) {
         $this->WhereAnd();
         $this->WhereValue($tr["cost_type_id"], DB_EQ, $cost_type_id);
     }
     if ($b_active_only === true) {
         $this->WhereAND();
         $this->WhereValue($tr["b_active"], DB_EQ, 1);
     }
     if ($current_customer_group !== NULL) {
         $this->WhereAnd();
         $this->WhereValue($tr["customer_group_id"], DB_EQ, $current_customer_group);
     }
     $this->SelectOrder($tr['customer_group_id']);
     $this->SelectOrder($tr['rv_from']);
 }
 /**
  * Uninstall the module.
  *                           .
  *
  *       uninstall()                      .
  *
  *                                          ,         ,
  * Quantity_Discounts::getTables()        $this->getTables()
  */
 function uninstall()
 {
     $query = new DB_Table_Delete(Quantity_Discounts::getTables());
     global $application;
     $application->db->getDB_Result($query);
 }