function uninstall()
 {
     global $application;
     $tables = Configuration::getTables();
     $columns = $tables['store_settings']['columns'];
     $query = new DB_Delete('store_settings');
     $query->WhereValue($columns['name'], DB_EQ, STOREFRONT_ACTIVE_SKIN);
     $application->db->getDB_Result($query);
 }
 function delManufacturers($mnf_ids)
 {
     global $application;
     $tables = $this->getTables();
     $mnf_table = $tables['manufacturers']['columns'];
     //
     foreach ($mnf_ids as $mnf_id) {
         $mnf_info = modApiFunc("Manufacturers", "getManufacturerInfo", $mnf_id);
         if ($mnf_info['manufacturer_image_id'] !== NULL) {
             modApiFunc('EventsManager', 'throwEvent', 'ImageFKRemovedEvent', $mnf_info['manufacturer_image_id']);
         }
     }
     $query = new DB_Delete('manufacturers');
     $query->Where($mnf_table['manufacturer_id'], DB_IN, '(\'' . implode('\',\'', $mnf_ids) . '\')');
     $application->db->PrepareSQL($query);
     $application->db->DB_Exec();
     modApiFunc('EventsManager', 'throwEvent', 'ManufacturerDeleted', $mnf_ids);
     return;
 }
 /**
  * @param $s_info shipping info of the destination
  * @param $weight weight of the package
  * @param $rates array of the shipping rates for saving
  */
 function saveRatesToCache($s_info, $weight, $rates)
 {
     if ($s_info["isMet"] == false or empty($rates)) {
         return;
     }
     $s_country = modApiFunc("Location", "getCountry", $s_info["validatedData"]["Country"]["value"]);
     $s_zipcode = $s_info["validatedData"]["Postcode"]["value"];
     $s_name = isset($s_info["validatedData"]["Firstname"]["value"]) ? $s_info["validatedData"]["Firstname"]["value"] : '';
     $s_name .= isset($s_info["validatedData"]["Lastname"]["value"]) ? $s_info["validatedData"]["Lastname"]["value"] : '';
     $hash = md5($s_country . $s_name . $s_zipcode . $weight);
     $tables = $this->getTables();
     $rc_table = $tables['sm_dsr_rates_cache']['columns'];
     global $application;
     $query = new DB_Delete('sm_dsr_rates_cache');
     $query->Where($rc_table['hash'], DB_EQ, "'{$hash}'");
     $application->db->getDB_Result($query);
     $query = new DB_Delete('sm_dsr_rates_cache');
     $query->Where($rc_table['expire'], DB_LT, time());
     $application->db->getDB_Result($query);
     foreach ($rates as $key => $rate_info) {
         $query = new DB_Insert('sm_dsr_rates_cache');
         $query->addInsertValue($hash, $rc_table["hash"]);
         $query->addInsertValue($rate_info["id"], $rc_table["method_id"]);
         $query->addInsertValue($rate_info["cost"], $rc_table["rate"]);
         $query->addInsertValue(time() + 18000, $rc_table["expire"]);
         $application->db->getDB_Result($query);
     }
     return;
 }
 function DeleteOrders($ordersId)
 {
     global $application;
     $tables = $this->getTables();
     $opc = $tables['order_gc']['columns'];
     $DB_IN_string = "('" . implode("', '", $ordersId) . "')";
     $query = new DB_Delete('order_gc');
     $query->WhereField($opc['gc_ord_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
 }
 function dropMessageGroupByMetaId($prefix)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['resource_labels']['columns'];
     $query = new DB_Delete('resource_labels');
     $query->WhereValue($tr['res_prefix'], DB_EQ, $prefix);
     $application->db->getDB_Result($query);
 }
Esempio n. 6
0
 function DELETE_BESTSELLER_LINKS_FROM_CATEGORY()
 {
     parent::DB_Delete('bs_links');
 }
 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;
 }
Esempio n. 8
0
/**
 * Removes option by name. Prevents removal of protected Avactis options.
 *
 * @package Avactis
 * @subpackage Option
 * @since 4.7.5
 *
 *
 * @param string $option Name of option to remove.
 */
function asc_delete_option($option)
{
    global $application;
    $option = trim($option);
    if (empty($option)) {
        return false;
    }
    $result = asc_get_option($option);
    if ($result) {
        $tables = Configuration::getTables();
        $tr = $tables['options']['columns'];
        $db_delete = new DB_Delete('options');
        $db_delete->WhereValue($tr['option_name'], DB_EQ, $option);
        $application->db->PrepareSQL($db_delete);
        $application->db->DB_Exec();
        /**
         * Fires after a specific option has been deleted.
         *
         * The dynamic portion of the hook name, `$option`, refers to the option name.
         *
         * @param string $option Name of the deleted option.
         */
        do_action("asc_delete_option_{$option}", $option);
        return true;
    } else {
        return '';
    }
}
Esempio n. 9
0
 function DELETE_CUSTOMER_GROUP()
 {
     parent::DB_Delete('ca_customer_groups');
 }
Esempio n. 10
0
 function NLT_DELETE_MESSAGE()
 {
     parent::DB_Delete('newsletter_letters');
 }
Esempio n. 11
0
 function DELETE_ML_RECORDS_BY_LABEL_AND_LABEL_KEY()
 {
     parent::DB_Delete('multilang_data');
 }
Esempio n. 12
0
 function RESET_REPORT_TABLE_DATA()
 {
     parent::DB_Delete('table_name');
     /*@ it is not a very good idea*/
 }
Esempio n. 13
0
 function DELETE_INPUT_TYPE_VALUES_BY_INPUT_TYPE_ID()
 {
     parent::DB_Delete('input_type_values');
 }
 /**
  *                                            .
  *
  * @param string $event_name
  * @param string $handler_class
  * @param string $handler_method
  */
 function removeEventHandler($event_name, $handler_class, $handler_method)
 {
     global $application;
     $tables = EventsManager::getTables();
     $tbl_events = $tables['events_manager']['columns'];
     $query = new DB_Delete('events_manager');
     $query->WhereValue($tbl_events['event_name'], DB_EQ, $event_name);
     $query->WhereAND();
     $query->WhereValue($tbl_events['handler_class'], DB_EQ, $handler_class);
     $query->WhereAND();
     $query->WhereValue($tbl_events['handler_method'], DB_EQ, $handler_method);
     $application->db->getDB_Result($query);
 }
 /**
  *
  *
  * @param array $address_id_array -        id
  */
 function deleteRowsFromPromoCode($id_array)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['promo_codes_coupons_table']['columns'];
     $query = new DB_Delete('promo_codes_coupons_table');
     $query->WhereField($tr['id'], DB_IN, "('" . implode("', '", $id_array) . "') ");
     $application->db->getDB_Result($query);
 }
Esempio n. 16
0
 function deleteBannersImageContent($image_ids)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['banners_images']['columns'];
     $query = new DB_Delete('banners_images');
     $query->WhereField($tr['imageid'], DB_IN, "('" . implode("', '", $image_ids) . "') ");
     $application->db->getDB_Result($query);
 }
 function delAllImagesFromProducts($products_ids)
 {
     global $application;
     $tables = $this->getTables();
     $images_table = $tables['pi_images']['columns'];
     $query = new DB_Select();
     $query->addSelectField($images_table['image_path']);
     $query->addSelectField($images_table['thumb_path']);
     $query->Where($images_table['product_id'], DB_IN, "('" . implode("','", $products_ids) . "')");
     $res = $application->db->getDB_Result($query);
     if (count($res) > 0) {
         //$this->unlinkFiles($res);
         $query = new DB_Delete('pi_images');
         $query->deleteMultiLangField($images_table['alt_text'], $images_table['image_id'], 'Product_Images');
         $query->Where($images_table['product_id'], DB_IN, "('" . implode("','", $products_ids) . "')");
         $application->db->getDB_Result($query);
     }
     return;
 }
Esempio n. 18
0
 /**
  *
  */
 function clearDB($session_id = "")
 {
     global $application;
     if (!$session_id) {
         $session_id = session_id();
     }
     $tables = $this->getTables();
     $table = 'crypto_keys';
     $k = $tables[$table]['columns'];
     $query = new DB_Delete('crypto_keys');
     $query->WhereValue($k["id"], DB_EQ, $session_id);
     $application->db->getDB_Result($query);
 }
 function setLetterTopics($letter_id, $topics_ids)
 {
     global $application;
     if (!is_array($topics_ids)) {
         $topics_ids = array($topics_ids);
     }
     $tables = $this->getTables();
     $ntables = modApiFunc('Newsletter', 'getTables');
     $ltable = 'newsletter_topics';
     $lcolumns =& $ntables[$ltable]['columns'];
     $dquery = new DB_Delete($ltable);
     $dquery->WhereValue($lcolumns['letter_id'], DB_EQ, $letter_id);
     $application->db->getDB_Result($dquery);
     $iquery = new DB_Multiple_Insert($ltable);
     $iquery->setModifiers(DB_IGNORE);
     $iquery->setInsertFields(array('letter_id', 'topic_id'));
     foreach ($topics_ids as $topic_id) {
         $iquery->addInsertValuesArray(array('letter_id' => $letter_id, 'topic_id' => $topic_id));
     }
     $application->db->getDB_Result($iquery);
 }
 function deleteCustomers($customers_ids)
 {
     if (!is_array($customers_ids) or empty($customers_ids)) {
         return false;
     }
     global $application;
     $ca_tables = $this->getTables();
     $co_tables = modApiStaticFunc('Checkout', 'getTables');
     $query = new DB_Select();
     $query->addSelectTable('orders');
     $query->addSelectField($co_tables['orders']['columns']['id'], 'order_id');
     $query->Where($co_tables['orders']['columns']['person_id'], DB_IN, "(" . implode(", ", $customers_ids) . ")");
     $res = $application->db->getDB_Result($query);
     $orders_ids = array();
     for ($i = 0; $i < count($res); $i++) {
         $orders_ids[] = $res[$i]['order_id'];
     }
     if (!empty($orders_ids)) {
         modApiFunc('Checkout', 'DeleteOrders', $orders_ids);
     }
     $accounts = array();
     $query = new DB_Select();
     $query->addSelectField($ca_tables['ca_customers']['columns']['customer_account'], 'customer_account');
     $query->addSelectTable('ca_customers');
     $query->Where($ca_tables['ca_customers']['columns']['customer_id'], DB_IN, "(" . implode(", ", $customers_ids) . ")");
     $res = $application->db->getDB_Result($query);
     for ($i = 0; $i < count($res); $i++) {
         $accounts[] = $res[$i]['customer_account'];
     }
     if (!empty($accounts)) {
         $query = new DB_Delete('ca_activation_keys');
         $query->Where($ca_tables['ca_activation_keys']['columns']['customer_account'], DB_IN, "('" . implode("','", $accounts) . "')");
         $application->db->PrepareSQL($query);
         $application->db->DB_Exec();
     }
     $query = new DB_Delete('ca_person_info_data');
     $query->Where($ca_tables['ca_person_info_data']['columns']['customer_id'], DB_IN, "(" . implode(", ", $customers_ids) . ")");
     $application->db->PrepareSQL($query);
     $application->db->DB_Exec();
     $query = new DB_Delete('ca_customers');
     $query->Where($ca_tables['ca_customers']['columns']['customer_id'], DB_IN, "(" . implode(", ", $customers_ids) . ")");
     $application->db->PrepareSQL($query);
     $application->db->DB_Exec();
     return true;
 }
 /**
  *
  *
  * @param array $address_id_array -        id
  */
 function deleteRowsFromQuantityDiscount($rate_id_array)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['quantity_discounts_rates_table']['columns'];
     $query = new DB_Delete('quantity_discounts_rates_table');
     $query->WhereField($tr['id'], DB_IN, "('" . implode("', '", $rate_id_array) . "') ");
     $application->db->getDB_Result($query);
 }
 /**
  * Deletes data of specified variant_info from the order.
  */
 function removePersonInfoOrderData($order_id, $person_info_variant_id)
 {
     global $application;
     $tables = $this->getTables();
     $opd = $tables['order_person_data']['columns'];
     $query = new DB_Delete("order_person_data");
     $query->WhereValue($opd["order_id"], DB_EQ, (int) $order_id);
     $query->WhereAnd();
     $query->WhereValue($opd["variant_id"], DB_EQ, (int) $person_info_variant_id);
     $application->db->getDB_Result($query);
 }
Esempio n. 23
0
 function DELETE_COLOR_SWATCH_ROW_BY_ID()
 {
     parent::DB_Delete('color_swatch');
 }
Esempio n. 24
0
 function DELETE_CMS_MENU()
 {
     parent::DB_Delete('cms_menu');
 }
Esempio n. 25
0
 /**
  * Deletes admins from the database.
  *
  * @param array $array_id - admin id array to delete
  * @return
  */
 function deleteAdmins($array_id)
 {
     if (!is_array($array_id)) {
         return;
     }
     global $application;
     $tables = $this->getTables();
     $a = $tables['admin']['columns'];
     $query = new DB_Delete('admin');
     $query->WhereField($a['id'], DB_IN, "(" . implode(", ", $array_id) . ")");
     $application->db->getDB_Result($query);
 }
 function removeCustomInfoTag($tagname)
 {
     global $application;
     $tagname = '{' . $tagname . '}';
     $tables = $this->getTables();
     $ni = $tables['notification_infotags']['columns'];
     $i2a = $tables['infotags_to_action']['columns'];
     // checking if the infotag exists
     $query = new DB_Select();
     $query->addSelectField($ni['id'], 'id');
     $query->WhereValue($ni['name'], DB_EQ, $tagname);
     $result = $application->db->getDB_Result($query);
     if (empty($result)) {
         return;
     }
     foreach ($result as $tag) {
         $id = $tag['id'];
         $query = new DB_Delete('infotags_to_action');
         $query->WhereValue($i2a['ni_id'], DB_EQ, $id);
         $application->db->getDB_Result($query);
         $query = new DB_Delete('notification_infotags');
         $query->WhereValue($ni['id'], DB_EQ, $id);
         $application->db->getDB_Result($query);
     }
 }
 function clearAttributesForCardType($type)
 {
     global $application;
     $tables = Configuration::getTables();
     $attributes = $tables['credit_card_attributes_to_types']['columns'];
     $query = new DB_Delete('credit_card_attributes_to_types');
     $query->WhereValue($attributes['type'], DB_EQ, $type);
     $application->db->getDB_Result($query);
 }
 function OnCategoriesWereDeleted($categories_ids)
 {
     if (!is_array($categories_ids) or empty($categories_ids)) {
         return;
     }
     global $application;
     $tables = $this->getTables();
     $fp_table = $tables['fp_links']['columns'];
     $query = new DB_Delete('fp_links');
     $query->Where($fp_table['category_id'], DB_IN, "(" . implode(", ", $categories_ids) . ")");
     $application->db->PrepareSQL($query);
     return $application->db->DB_Exec();
 }
Esempio n. 29
0
 function update_pm_sm_currency_settings($module_id, $module_settings)
 {
     global $application;
     loadCoreFile('db_multiple_insert.php');
     //The list of modules,which should become selected.
     $tables = Checkout::getTables();
     //                                                     pm_sm_accepted_currencies
     //    pm_sm_currency_acceptance_rules.
     $cpsac = $tables['checkout_pm_sm_accepted_currencies']['columns'];
     $query = new DB_Delete('checkout_pm_sm_accepted_currencies');
     $query->WhereValue($cpsac['module_id'], DB_EQ, $module_id);
     $application->db->getDB_Result($query);
     $cpscar = $tables['checkout_pm_sm_currency_acceptance_rules']['columns'];
     $query = new DB_Delete('checkout_pm_sm_currency_acceptance_rules');
     $query->WhereValue($cpscar['module_id'], DB_EQ, $module_id);
     $application->db->getDB_Result($query);
     //                      (      )                                   pm_sm_accepted_currencies
     //    pm_sm_currency_acceptance_rules.
     if (sizeof($module_settings["accepted_currencies"]) > 0) {
         $query = new DB_Multiple_Insert('checkout_pm_sm_accepted_currencies');
         $query->setInsertFields(array($cpsac['module_id'], $cpsac['currency_code'], $cpsac['currency_status']));
         foreach ($module_settings["accepted_currencies"] as $info) {
             $row = array($cpsac['module_id'] => $module_id, $cpsac['currency_code'] => $info['currency_code'], $cpsac['currency_status'] => $info['currency_status']);
             $query->addInsertValuesArray($row);
         }
         $application->db->PrepareSQL($query);
         $application->db->DB_Exec();
     }
     if (sizeof($module_settings["currency_acceptance_rules"]) > 0) {
         $query = new DB_Multiple_Insert('checkout_pm_sm_currency_acceptance_rules');
         $query->setInsertFields(array($cpscar['module_id'], $cpscar['rule_name'], $cpscar['rule_selected']));
         foreach ($module_settings["currency_acceptance_rules"] as $info) {
             $row = array($cpscar['module_id'] => $module_id, $cpscar['rule_name'] => $info['rule_name'], $cpscar['rule_selected'] => $info['rule_selected']);
             $query->addInsertValuesArray($row);
         }
         $application->db->PrepareSQL($query);
         $application->db->DB_Exec();
     }
 }
 function deleteFsRuleByIdsArray($id_array)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['scc_fs_rules']['columns'];
     $query = new DB_Delete('scc_fs_rules');
     $query->WhereField($tr['id'], DB_IN, "('" . implode("', '", $id_array) . "') ");
     $application->db->getDB_Result($query);
 }