Example #1
0
 public function add()
 {
     $db = JFactory::getDBO();
     $query = "INSERT INTO " . $db->quoteName('#__jeproshop_specific_price') . "(" . $db->quoteName('specific_price_rule_id');
     $query .= ", " . $db->quoteName('product_id') . ", " . $db->quoteName('shop_id') . ", " . $db->quoteName('shop_group_id');
     $query .= ", " . $db->quoteName('currency_id') . ", " . $db->quoteName('country_id') . ", " . $db->quoteName('group_id');
     $query .= ", " . $db->quoteName('customer_id') . ", " . $db->quoteName('product_attribute_id') . ", " . $db->quoteName('price');
     $query .= ", " . $db->quoteName('from_quantity') . ", " . $db->quoteName('reduction') . ", " . $db->quoteName('reduction_type');
     $query .= ", " . $db->quoteName('from') . ", " . $db->quoteName('to') . ") VALUES (" . (int) $this->specific_price_rule_id . ", ";
     $query .= (int) $this->product_id . ", " . (int) $this->shop_id . ", " . (int) $this->shop_group_id . ", " . (int) $this->currency_id . ", ";
     $query .= (int) $this->country_id . ", " . (int) $this->group_id . ", " . (int) $this->customer_id . ", " . (int) $this->product_attribute_id;
     $query .= ", " . (double) $this->price . ", " . (int) $this->from_quantity . ", " . (double) $this->reduction . ", " . $db->quote($this->reduction_type);
     $query .= ", " . $db->quote($this->from) . ", " . $db->quote($this->to) . ")";
     $db->setQuery($query);
     if ($db->query()) {
         // Flush cache when we adding a new specific price
         JeproshopSpecificPriceModelSpecificPrice::$_specific_price_cache = array();
         JeproshopProductModelProduct::flushPriceCache();
         // Set cache of feature detachable to true
         JeproshopSettingModelSetting::updateValue('specific_price_feature_active', '1');
         return true;
     }
     return false;
 }