function OnProductsWereDeleted($products_ids) { if (!is_array($products_ids) or empty($products_ids)) { return; } global $application; $tables = $this->getTables(); $rp_table = $tables['rp_links']['columns']; $query = new DB_Delete('rp_links'); $query->Where($rp_table['product_id'], DB_IN, "(" . implode(", ", $products_ids) . ")"); $query->WhereOR(); $query->Where($rp_table['rp_id'], DB_IN, "(" . implode(", ", $products_ids) . ")"); $application->db->PrepareSQL($query); return $application->db->DB_Exec(); }
function __delRateFromCache($from, $to) { global $application; $tables = $this->getTables(); $rc_table = $tables['cconv_rates_cache']['columns']; $query = new DB_Delete('cconv_rates_cache'); $query->addWhereOpenSection(); $query->WhereValue($rc_table['from'], DB_EQ, $from); $query->WhereAnd(); $query->WhereValue($rc_table['to'], DB_EQ, $to); $query->addWhereCloseSection(); $query->WhereOR(); $query->addWhereOpenSection(); $query->WhereValue($rc_table['from'], DB_EQ, $to); $query->WhereAND(); $query->WhereValue($rc_table['to'], DB_EQ, $from); $query->addWhereCloseSection(); $application->db->getDB_Result($query); return; }
/** * Deletes combination rules by the content type. * * @param string $by_type - enum('option_id','value_id') * @param int $by_id - ID of the thing which is directed while deleting * @return true if it is deleted, false otherwise */ function __delCRulesBy($by_type, $by_id) { if (!in_array($by_type, array('option_id', 'value_id')) or !is_numeric($by_id)) { return false; } global $application; $tables = $this->getTables(); $crs_table = $tables['po_crules']['columns']; $query = new DB_Delete('po_crules'); switch ($by_type) { case "option_id": $query->WhereValue($crs_table['sside'], DB_LIKE, '%[' . $by_id . ']%'); $query->WhereOR(); $query->WhereValue($crs_table['lside'], DB_LIKE, '%[' . $by_id . ']%'); $query->WhereOR(); $query->WhereValue($crs_table['rside'], DB_LIKE, '%[' . $by_id . ']%'); break; case "value_id": $query->WhereValue($crs_table['sside'], DB_LIKE, '%{' . $by_id . '}%'); $query->WhereOR(); $query->WhereValue($crs_table['lside'], DB_LIKE, '%{' . $by_id . '}%'); $query->WhereOR(); $query->WhereValue($crs_table['rside'], DB_LIKE, '%{' . $by_id . '}%'); break; } $application->db->PrepareSQL($query); return $application->db->DB_Exec(); }