Example #1
0
             tep_db_query($sql);
         }
     }
     tep_exit();
     break;
 case 'update_product_description':
     set_time_limit(6000);
     $products_query = tep_db_query("select products_id, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . (int) $languages_id . "'" . ($HTTP_GET_VARS['products_id'] > 0 ? " and products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "'" : "") . " and products_description <> ''");
     while ($products = tep_db_fetch_array($products_query)) {
         $products_id = $products['products_id'];
         $check_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int) $products_id . "' and language_id = '1'");
         $check = tep_db_fetch_array($check_query);
         $check['products_description'] = trim(html_entity_decode($check['products_description'], ENT_QUOTES));
         if (empty($check['products_description'])) {
             $products_description = '';
             $result = tep_get_translation($products['products_description']);
             $products_description = $result['translation'];
             $sql = "update " . TABLE_PRODUCTS_DESCRIPTION . " set products_description = '" . tep_db_input($products_description) . "' where products_id = '" . (int) $products_id . "' and language_id = '1'";
             tep_db_query($sql);
         }
     }
     tep_exit();
     break;
 case 'subscribe':
     if (tep_session_is_registered('customer_id')) {
         $sub = (int) $HTTP_GET_VARS['sub'];
         $type = (int) $HTTP_GET_VARS['type'];
         //1: Тематики и разделы
         //2: Серии
         //3: Авторы
         //4: Издательство
Example #2
0
tep_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '1' and products_name = ''");
//  echo mysql_affected_rows();
//  die;
$fields = array('products_name', 'products_description');
$products_query = tep_db_query("select products_id, products_name, products_description, products_model, authors_name, categories_name, manufacturers_name, series_name from " . TABLE_PRODUCTS_INFO . " where products_id not in (select products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '1') order by rand()");
while ($products = tep_db_fetch_array($products_query)) {
    $products_id = $products['products_id'];
    $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int) $products_id . "' and language_id = '1'");
    $check = tep_db_fetch_array($check_query);
    if ($check['total'] == 0) {
        reset($fields);
        $products_name = '';
        $products_description = '';
        while (list(, $field) = each($fields)) {
            if (tep_not_null($products[$field])) {
                ${$field} = tep_get_translation($products[$field]);
            } else {
                ${$field} = '';
            }
        }
        $products_text = $products_name;
        $products_model = $products['products_model'];
        $authors_name = tep_transliterate($products['authors_name']);
        $manufacturers_name = tep_transliterate($products['manufacturers_name']);
        $product_serie_info_query = tep_db_query("select series_id from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
        $product_serie_info = tep_db_fetch_array($product_serie_info_query);
        $serie_info_query = tep_db_query("select series_name from " . TABLE_SERIES . " where series_id = '" . (int) $product_serie_info['series_id'] . "' and language_id = '1'");
        $serie_info = tep_db_fetch_array($serie_info_query);
        $series_name = $serie_info['series_name'];
        if (tep_not_null($products_model)) {
            $products_text .= ' ISBN ' . $products_model;
Example #3
0
reset($languages_array);
while (list($lang_code, $lang_id) = each($languages_array)) {
    tep_db_query("delete from " . TABLE_AUTHORS . " where language_id = '" . (int) $lang_id . "' and authors_name = ''");
    $fields = array('authors_description');
    $authors_query = tep_db_query("select authors_id, authors_name, authors_description from " . TABLE_AUTHORS . " where authors_status = '1' and authors_id not in (select authors_id from " . TABLE_AUTHORS . " where language_id = '" . (int) $lang_id . "')");
    while ($authors = tep_db_fetch_array($authors_query)) {
        $authors_id = $authors['authors_id'];
        $authors_name = tep_transliterate($authors['authors_name']);
        $check_query = tep_db_query("select count(*) as total from " . TABLE_AUTHORS . " where authors_id = '" . (int) $authors_id . "' and language_id = '" . (int) $lang_id . "'");
        $check = tep_db_fetch_array($check_query);
        if ($check['total'] == 0) {
            $authors_description = '';
            reset($fields);
            while (list(, $field) = each($fields)) {
                if (tep_not_null($authors[$field])) {
                    ${$field} = tep_get_translation($authors[$field]);
                } else {
                    ${$field} = '';
                }
            }
            $letter_query = tep_db_query("select authors_letter from " . TABLE_AUTHORS . " where authors_id = '" . (int) $authors_id . "' and language_id = '" . (int) $languages_id . "'");
            $letter = tep_db_fetch_array($letter_query);
            $sql = "replace into " . TABLE_AUTHORS . " (authors_id, authors_code, authors_letter, authors_name, authors_description, language_id, authors_image, authors_status, authors_path, sort_order, date_added, last_modified) select authors_id, authors_code, '" . tep_db_input(tep_transliterate($letter['authors_letter'])) . "', '" . tep_db_input($authors_name) . "', '" . tep_db_input($authors_description) . "', '" . (int) $lang_id . "', authors_image, authors_status, authors_path, sort_order, date_added, last_modified from " . TABLE_AUTHORS . " where authors_id = '" . (int) $authors_id . "' and language_id = '" . (int) $languages_id . "'";
            tep_db_query($sql);
        }
        $content_type = 'author';
        $content_id = $authors_id;
        $check_query = tep_db_query("select count(*) as total from " . TABLE_METATAGS . " where language_id = '" . (int) $lang_id . "' and content_type = '" . tep_db_input($content_type) . "' and content_id = '" . (int) $content_id . "'");
        $check = tep_db_fetch_array($check_query);
        if ($check['total'] == 0) {
            $metatags_page_title = $common_array[$lang_code]['authors'] . '. ' . $authors_name . (substr($authors_name, -1) != '.' ? '.' : '') . ' ' . $common_array[$lang_code]['bookshop'] . ' Setbook.';
Example #4
0
     if ($series['products_types_id'] == 1) {
         $manufacturer_info_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int) $manufacturers_id . "' and languages_id = '" . (int) $lang_id . "'");
         $manufacturer_info = tep_db_fetch_array($manufacturer_info_query);
         $manufacturers_name = $manufacturer_info['manufacturers_name'];
     }
     $check_query = tep_db_query("select count(*) as total from " . TABLE_METATAGS . " where language_id = '" . (int) $lang_id . "' and content_type = '" . tep_db_input($content_type) . "' and content_id = '" . (int) $content_id . "'");
     $check = tep_db_fetch_array($check_query);
     if ($check['total'] == 0) {
         if (empty($series_name)) {
             $series_name = tep_get_translation($series['series_name'], 'ru', $lang_code);
         }
         if (empty($common_array[$lang_code]['type'][$series['products_types_id']])) {
             $product_type_info_query = tep_db_query("select products_types_name from " . TABLE_PRODUCTS_TYPES . " where products_types_id = '" . (int) $series['products_types_id'] . "' and language_id = '" . (int) $languages_id . "'");
             $product_type_info = tep_db_fetch_array($product_type_info_query);
             $products_types_name = $product_type_info['products_types_name'];
             $common_array[$lang_code]['type'][$series['products_types_id']] = tep_get_translation($products_types_name, 'ru', $lang_code);
         }
         $metatags_page_title = $common_array[$lang_code]['type'][$series['products_types_id']] . '. ' . $common_array[$lang_code]['series'] . '. ' . $series_name . (substr($series_name, -1) != '.' ? '.' : '') . (strlen($manufacturers_name) > 2 ? ' ' . $common_array[$lang_code]['publisher'] . ' ' . $manufacturers_name . (substr($manufacturers_name, -1) != '.' ? '.' : '') : '') . ' ' . $common_array[$lang_code]['bookshop'] . ' Setbook.';
         $metatags_title = $series_name;
         $metatags_keywords = $series_name . (strlen($manufacturers_name) > 2 ? ' ' . $common_array[$lang_code]['publisher'] . '  ' . $manufacturers_name . (substr($manufacturers_name, -1) != '.' ? '.' : '') : '');
         $metatags_description = $common_array[$lang_code]['type'][$series['products_types_id']] . '. ' . $common_array[$lang_code]['series'] . '. ' . $series_name . (substr($series_name, -1) != '.' ? '.' : '') . (strlen($manufacturers_name) > 2 ? ' ' . $common_array[$lang_code]['publisher'] . ' ' . $manufacturers_name . (substr($manufacturers_name, -1) != '.' ? '.' : '') : '');
         tep_db_query("replace into " . TABLE_METATAGS . " (metatags_page_title, metatags_title, metatags_keywords, metatags_description, language_id, content_type, content_id) values ('" . tep_db_input($metatags_page_title) . "', '" . tep_db_input($metatags_title) . "', '" . tep_db_input($metatags_keywords) . "', '" . tep_db_input($metatags_description) . "', '" . (int) $lang_id . "', '" . tep_db_input($content_type) . "', '" . (int) $content_id . "')");
     }
 }
 if ($series_name == '') {
     $not_translated_series_count++;
 } else {
     $not_translated_series_count = 0;
 }
 if ($not_translated_series_count > 10) {
     break;
reset($languages_array);
while (list($lang_code, $lang_id) = each($languages_array)) {
    tep_db_query("delete from " . TABLE_MANUFACTURERS_INFO . " where languages_id = '" . (int) $lang_id . "' and manufacturers_name = ''");
    $fields = array('manufacturers_description');
    $manufacturers_query = tep_db_query("select mi.manufacturers_id, mi.manufacturers_name, mi.manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " mi, " . TABLE_MANUFACTURERS . " m where m.manufacturers_status = '1' and m.manufacturers_id = mi.manufacturers_id and mi.manufacturers_id not in (select manufacturers_id from " . TABLE_MANUFACTURERS_INFO . " where languages_id = '" . (int) $lang_id . "')");
    while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
        $manufacturers_id = $manufacturers['manufacturers_id'];
        $manufacturers_name = tep_transliterate($manufacturers['manufacturers_name']);
        $check_query = tep_db_query("select count(*) as total from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int) $manufacturers_id . "' and languages_id = '" . (int) $lang_id . "'");
        $check = tep_db_fetch_array($check_query);
        if ($check['total'] == 0) {
            $manufacturers_description = '';
            reset($fields);
            while (list(, $field) = each($fields)) {
                if (tep_not_null($manufacturers[$field])) {
                    ${$field} = tep_get_translation($manufacturers[$field], 'ru', $lang_code);
                } else {
                    ${$field} = '';
                }
            }
            $sql = "insert ignore into " . TABLE_MANUFACTURERS_INFO . " (manufacturers_id, manufacturers_name, manufacturers_description, languages_id, manufacturers_url, url_clicked, date_last_click) select manufacturers_id, '" . tep_db_input($manufacturers_name) . "', '" . tep_db_input($manufacturers_description) . "', '" . (int) $lang_id . "', manufacturers_url, url_clicked, date_last_click from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int) $manufacturers_id . "' and languages_id = '" . (int) $languages_id . "'";
            tep_db_query($sql);
        }
        $content_type = 'manufacturer';
        $content_id = $manufacturers_id;
        $check_query = tep_db_query("select count(*) as total from " . TABLE_METATAGS . " where language_id = '" . (int) $lang_id . "' and content_type = '" . tep_db_input($content_type) . "' and content_id = '" . (int) $content_id . "'");
        $check = tep_db_fetch_array($check_query);
        if ($check['total'] == 0) {
            $metatags_page_title = $common_array[$lang_code]['publishers'] . '. ' . $manufacturers_name . (substr($manufacturers_name, -1) != '.' ? '.' : '') . ' ' . $common_array[$lang_code]['bookshop'] . ' Setbook.';
            $metatags_title = $manufacturers_name;
            $metatags_keywords = $manufacturers_name;
Example #6
0
}
$products_types_names = array();
tep_db_query("delete from " . TABLE_CATEGORIES_DESCRIPTION . " where language_id = '1' and categories_name = ''");
$fields = array('categories_name', 'categories_description');
$categories_query = tep_db_query("select categories_id, categories_name, categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id not in (select categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " where language_id = '1') order by rand()");
while ($categories = tep_db_fetch_array($categories_query)) {
    $categories_id = $categories['categories_id'];
    $check_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int) $categories_id . "' and language_id = '1'");
    $check = tep_db_fetch_array($check_query);
    if ($check['total'] == 0) {
        $categories_name = '';
        $categories_description = '';
        reset($fields);
        while (list(, $field) = each($fields)) {
            if (tep_not_null($categories[$field])) {
                ${$field} = tep_get_translation($categories[$field]);
            } else {
                ${$field} = '';
            }
        }
        $sql = "replace into " . TABLE_CATEGORIES_DESCRIPTION . " (categories_id, categories_name, categories_description, language_id) select categories_id, '" . tep_db_input($categories_name) . "', '" . tep_db_input($categories_description) . "', '1' from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int) $categories_id . "' and language_id = '" . (int) $languages_id . "'";
        tep_db_query($sql);
        $parent_categories = array($categories_id);
        tep_get_parents($parent_categories, $categories_id);
        $parent_categories = array_reverse($parent_categories);
        if (!isset($products_types_names[$products_types_id])) {
            $category_type_info_query = tep_db_query("select products_types_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int) $categories_id . "'");
            $category_type_info = tep_db_fetch_array($category_type_info_query);
            $products_types_id = $category_type_info['products_types_id'];
            $product_type_info_query = tep_db_query("select products_types_name from " . TABLE_PRODUCTS_TYPES . " where products_types_id = '" . (int) $products_types_id . "' and language_id = '1'");
            $product_type_info = tep_db_fetch_array($product_type_info_query);