$min_specials_date_added = date('Y-m-d', $max_specials_date - 60 * 60 * 24 * 7); $query = tep_db_query("select p.products_id, (p.products_listing_status*5 + p.products_image_exists*3 + if((s.specials_types_id > 0), (" . (int) $max_specials_types_id . " - s.specials_types_id), 0)) as new_sort_order from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on (s.products_id = p.products_id and date_format(s.specials_date_added, '%Y-%m-%d') >= '" . tep_db_input($min_specials_date_added) . "') where 1 order by new_sort_order desc, products_price"); $s = 1; while ($row = tep_db_fetch_array($query)) { tep_db_query("update " . TABLE_PRODUCTS . " set sort_order = '" . (int) $s . "' where products_id = '" . (int) $row['products_id'] . "'"); $s++; } tep_db_select_db(DDB_DATABASE); echo 'OK'; die; require DIR_WS_CLASSES . 'currencies.php'; $currencies = new currencies(); tep_set_time_limit(36000); $temp_tables = array(TABLE_PRODUCTS, TABLE_PRODUCTS_INFO, TABLE_SPECIALS); $in_shops = array(9, 10, 11, 14, 1); tep_update_all_shops(1); die; tep_set_time_limit(600); $products_invalid_images = array(); $products_query = tep_db_query("select products_id, products_code, products_image from " . TABLE_PRODUCTS . " where products_types_id = '1' and products_image_exists = '1'"); while ($products = tep_db_fetch_array($products_query)) { $products_code = str_replace('bbk', '', $products['products_code']); $products_original_image = UPLOAD_DIR . 'books/' . substr($products_code, 0, -2) . '/' . $products_code . '.jpg'; if (!file_exists($products_original_image)) { $products_invalid_images[] = $products['products_id']; unlink(DIR_FS_CATALOG_IMAGES . 'thumbs/' . $products['products_image']); unlink(DIR_FS_CATALOG_IMAGES_BIG . $products['products_image']); } } $shops_query = tep_db_query("select shops_database from " . TABLE_SHOPS . " where shops_database <> '' order by shops_default_status"); while ($shops = tep_db_fetch_array($shops_query)) {
tep_db_query("update " . TABLE_AUTHORS . " set authors_status = '0'"); tep_db_query("update " . TABLE_AUTHORS . " set authors_status = '1' where authors_id in (select distinct authors_id from " . TABLE_TEMP_PRODUCTS . " where products_status = '1')"); tep_mail('*****@*****.**', '*****@*****.**', 'Ўаг 5-8', '', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_status = '0'"); tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_status = '1' where manufacturers_id in (select distinct manufacturers_id from " . TABLE_TEMP_PRODUCTS . " where products_status = '1')"); tep_mail('*****@*****.**', '*****@*****.**', 'Ўаг 5-9', '', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); tep_db_query("update " . TABLE_SERIES . " set series_status = '0'"); tep_db_query("update " . TABLE_SERIES . " set series_status = '1' where series_id in (select distinct series_id from " . TABLE_TEMP_PRODUCTS . " where products_status = '1')"); tep_mail('*****@*****.**', '*****@*****.**', 'Ўаг 6', 'закончили запись обновлений', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); tep_mail('*****@*****.**', '*****@*****.**', 'Ўаг 7', 'начали запись обновлений дл¤ других Ѕƒ', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); if ($action == 'upload_other_products') { $update_products_types_id = ''; } else { $update_products_types_id = 1; } tep_update_all_shops($update_products_types_id); if (tep_not_null($last_upload_date)) { if ($action == 'upload_other_products') { $check_key = 'CONFIGURATION_LAST_UPDATE_DATE_OTHER'; } elseif ($action == 'upload_products') { $check_key = 'CONFIGURATION_LAST_UPDATE_DATE'; } else { $check_key = ''; } if (tep_not_null($check_key)) { tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($last_upload_date) . "', last_modified = now() where configuration_key = '" . tep_db_input($check_key) . "'"); } } tep_mail('*****@*****.**', '*****@*****.**', 'Ўаг 8', 'закончили запись обновлений дл¤ других Ѕƒ', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); tep_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '1' and products_name = ''"); $fields = array('products_name', 'products_description');