echo 'Выберите свой город:<br />' . "\n" . tep_draw_pull_down_menu('cities', $cities_array, '', 'onchange="if (this.options[this.selectedIndex].value > 0) { document.getElementById(\'confirmCity\').style.display = \'block\'; } if (document.getElementById(\'suburbs\').innerHTML!=\'\') getXMLDOM(\'' . tep_href_link(FILENAME_LOADER, 'action=load_suburbs', 'SSL') . '&country=' . tep_output_string_protected($HTTP_GET_VARS['country']) . '&city=\'+this.value, \'suburbs\');"') . '<br />' . "\n" . ($suburbs_count['total'] > 0 ? '<small>если Вашего города в списке нет, выберите ближайший районный центр</small><br />' . "\n" : '') . '<div id="suburbs" class="small"></div>' . "\n" . '<div id="confirmCity" style="display: none;">' . tep_draw_input_field('', 'Да, я живу тут!', 'onclick="var indexToLoad = \'\'; if (this.form.elements[\'suburbs\']) { if (suburbs.options[suburbs.selectedIndex].value!=\'\') indexToLoad = suburbs.options[suburbs.selectedIndex].value; } if (indexToLoad==\'\') { indexToLoad = cities.options[cities.selectedIndex].value; } if (indexToLoad!=\'\') { postcode.value = indexToLoad; loadCity(this.form, indexToLoad); document.getElementById(\'checkPostcode\').style.display = \'none\'; }"', 'button') . ($suburbs_count['total'] > 0 ? ' ' . tep_draw_input_field('', 'Я живу где-то рядом...', 'onclick="getXMLDOM(\'' . tep_href_link(FILENAME_LOADER, 'action=load_suburbs', 'SSL') . '&country=' . tep_output_string_protected($HTTP_GET_VARS['country']) . '&city=\'+cities.options[cities.selectedIndex].value, \'suburbs\'); this.style.display = \'none\';"', 'button') : '') . '</div>' . "\n"; tep_exit(); break; case 'load_suburbs': $cities_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT)); $cities_query = tep_db_query("select city_id, city_name from " . TABLE_CITIES . " where city_country_id = '" . (int) $HTTP_GET_VARS['country'] . "' and parent_id = '" . tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['city'])) . "' group by city_name order by city_name"); if (tep_db_num_rows($cities_query) > 0) { while ($cities = tep_db_fetch_array($cities_query)) { $cities_array[] = array('id' => $cities['city_id'], 'text' => $cities['city_name']); } echo 'Рядом расположены:<br />' . "\n" . tep_draw_pull_down_menu('suburbs', $cities_array); } tep_exit(); break; case 'load_category_level': echo tep_get_category_level($HTTP_GET_VARS['parent'], $HTTP_GET_VARS['level']); tep_exit(); break; case 'load_review': case 'load_board': if ($action == 'load_board') { $query = tep_db_query("select customers_boards_description as description from " . TABLE_CUSTOMERS_BOARDS . " where customers_boards_id = '" . (int) $HTTP_GET_VARS['boards_id'] . "'"); } else { $query = tep_db_query("select reviews_text as description from " . TABLE_REVIEWS . " where reviews_id = '" . (int) $HTTP_GET_VARS['reviews_id'] . "'"); } $row = tep_db_fetch_array($query); $description = $row['description']; $description = str_replace('<br />', "\n", $description); $description = str_replace('<p>', '', $description); $description = str_replace('</p>', "\n\n", $description); while (strpos($description, "\n\n") !== false) {
$wl_parameters = array('categories' => $wl_categories); $wl_categories_string = serialize($wl_parameters); $wishlist_check_query = tep_db_query("select wishlists_id from " . TABLE_WISHLISTS . " where customers_id = '" . (int) $customer_id . "'"); if (tep_db_num_rows($wishlist_check_query) > 0) { tep_db_query("update " . TABLE_WISHLISTS . " set wishlists_search_params = '" . tep_db_input($wl_categories_string) . "' where customers_id = '" . (int) $customer_id . "'"); } else { tep_db_query("insert into " . TABLE_WISHLISTS . " (customers_id, wishlists_search_params) values ('" . (int) $customer_id . "', '" . tep_db_input($wl_categories_string) . "')"); } $customers_name = trim($customer_first_name . ' ' . $customer_last_name); $email_subject = STORE_NAME . ' - ' . sprintf(EMAIL_WISHLIST_SUBJECT, $customers_name); $customer_company_info_query = tep_db_query("select companies_name from " . TABLE_COMPANIES . " where customers_id = '" . (int) $customer_id . "'"); $customer_company_info = tep_db_fetch_array($customer_company_info_query); $customer_info_query = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'"); $customer_info = tep_db_fetch_array($customer_info_query); $customers_full_data = $customers_name . ' (' . (tep_not_null($customer_company_info['companies_name']) ? $customer_company_info['companies_name'] . ', ' : '') . $customer_info['customers_email_address'] . ')'; $wls_tree = tep_get_category_level(0, 0, 1, $wl_categories, false); $wls_tree = strip_tags(preg_replace('/<img[^>]+>/', ' ', str_replace("\t", '', $wls_tree))); while (strpos($wls_tree, "\n\n") !== false) { $wls_tree = str_replace("\n\n", "\n", $wls_tree); } if (sizeof($wl_categories) > 0) { $email_text = sprintf(EMAIL_WISHLIST_TEXT_1, $customers_full_data, $wls_tree); } else { $email_text = sprintf(EMAIL_WISHLIST_TEXT_2, $customers_full_data); } if (defined('SEND_WISHLISTS_EMAILS_TO') && tep_not_null(SEND_WISHLISTS_EMAILS_TO)) { tep_mail('', SEND_WISHLISTS_EMAILS_TO, $email_subject, $email_text, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); } $messageStack->add_session('header', SUCCESS_WISHLIST_UPDATED, 'success'); tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); // } else {
function tep_get_category_level($parent_id = 0, $level = 0, $products_types_id = '1', $opened_categories = array(), $in_form = true) { global $languages_id; $parent_categories = array(); if (sizeof($opened_categories) > 0) { reset($opened_categories); while (list(, $opened_category_id) = each($opened_categories)) { $parent_categories[] = $opened_category_id; tep_get_parents($parent_categories, $opened_category_id); } } $categories_string = ''; $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.products_types_id = '" . (int) $products_types_id . "' and c.parent_id = '" . (int) $parent_id . "'" . (!$in_form ? " and c.categories_id in ('" . implode("', '", $parent_categories) . "')" : "") . " and c.categories_id = cd.categories_id and cd.language_id = '" . (int) DEFAULT_LANGUAGE_ID . "' and c.categories_status = '1' order by c.sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query) > 0) { while ($categories = tep_db_fetch_array($categories_query)) { for ($i = 0; $i < $level; $i++) { $categories_string .= tep_draw_separator('pixel_trans.gif', 20, 1); } $show_sublevel = false; if (sizeof($opened_categories) > 0) { $subcategories = array(); tep_get_subcategories($subcategories, $categories['categories_id']); reset($subcategories); while (list(, $subcategory_id) = each($subcategories)) { if (in_array($subcategory_id, $opened_categories)) { $show_sublevel = true; break; } } } if (!$in_form) { $categories_string .= ''; } elseif (tep_has_category_subcategories($categories['categories_id'])) { $categories_string .= '<a href="#" id="wlh' . $categories['categories_id'] . '" onclick="loadLevel(\'' . tep_href_link(FILENAME_LOADER, 'action=load_category_level&parent=' . $categories['categories_id'] . '&level=' . ($level + 1), 'SSL') . '\', \'' . $categories['categories_id'] . '\', \'' . ($level + 1) . '\'); return false;" style="text-decoration: none; display: inline-block; width: 15px; text-align: center; font-size: 14px; height: 12px; vertical-align: top; padding-top: 2px;"> ' . ($show_sublevel ? '–' : '+') . ' </a>'; } else { $categories_string .= tep_draw_separator('pixel_trans.gif', 15, 1); } if ($in_form) { $categories_string .= tep_draw_checkbox_field('categories_' . $parent_id . '_' . $categories['categories_id'], $categories['categories_id'], in_array($categories['categories_id'], $opened_categories) ? true : false, 'id="wlc' . $categories['categories_id'] . '" onclick="checkChilds(\'' . $categories['categories_id'] . '\'); if (this.checked==false && document.getElementById(\'wlc' . $parent_id . '\')) document.getElementById(\'wlc' . $parent_id . '\').checked = false;"'); $categories_string .= '<label for="wlc' . $categories['categories_id'] . '">' . $categories['categories_name'] . '</label><br />' . "\n"; } else { if (in_array($categories['categories_id'], $opened_categories)) { $categories_string .= '<strong>' . $categories['categories_name'] . '</strong><br />' . "\n"; } else { $categories_string .= $categories['categories_name'] . '<br />' . "\n"; } } if ($show_sublevel) { $categories_string .= ' <div id="wls' . $categories['categories_id'] . '" style="padding: 0; margin: 0; display: block;">' . tep_get_category_level($categories['categories_id'], $level + 1, $products_types_id, $opened_categories, $in_form) . '</div>' . "\n"; } else { $categories_string .= ' <div id="wls' . $categories['categories_id'] . '" style="padding: 0; margin: 0; display: none;"></div>' . "\n"; } } } return $categories_string; }
<?php echo $page['pages_description']; ?> <?php echo tep_draw_form('account_wishlist', tep_href_link(FILENAME_ACCOUNT_WISHLIST, '', 'SSL'), 'post', 'class="form-div"') . tep_draw_hidden_field('action', $wls_check > 0 ? 'process' : 'update'); ?> <fieldset> <legend><?php echo MY_WISHLIST_TITLE; ?> </legend> <div> <?php echo tep_get_category_level(0, 0, 1, $wls_categories); ?> </div> </fieldset> <div class="buttons"> <div style="float: left;"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK, 'class="button_back"') . '</a>'; ?> </div> <div style="text-align: right;"><?php echo $wls_check > 0 ? tep_image_submit('button_update.gif', IMAGE_BUTTON_UPDATE) : tep_image_submit('button_insert.gif', IMAGE_BUTTON_INSERT); ?> </div> </div> </form>