Copyright (c) 2007 VaM Shop ----------------------------------------------------------------------------------------- based on: (c) 2000-2001 The Exchange Project (earlier name of osCommerce) (c) 2002-2003 osCommerce(search.php,v 1.22 2003/02/10); www.oscommerce.com (c) 2003 nextcommerce (search.php,v 1.9 2003/08/17); www.nextcommerce.org (c) 2004 xt:Commerce (search.php,v 1.9 2003/08/13); xt-commerce.com Released under the GNU General Public License ---------------------------------------------------------------------------------------*/ $box = new vamTemplate(); $box->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/'); $box_content = ''; require_once DIR_FS_INC . 'vam_image_submit.inc.php'; require_once DIR_FS_INC . 'vam_hide_session_id.inc.php'; $box->assign('FORM_ACTION', vam_draw_form('quick_find', vam_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . vam_hide_session_id()); $box->assign('INPUT_SEARCH', vam_draw_input_field('keywords', '', 'id="quick_find_keyword"')); $box->assign('BUTTON_SUBMIT', vam_image_submit('', IMAGE_BUTTON_SEARCH)); $box->assign('FORM_END', '</form>'); $box->assign('LINK_ADVANCED', vam_href_link(FILENAME_ADVANCED_SEARCH)); $box->assign('BOX_CONTENT', $box_content); $box->assign('language', $_SESSION['language']); // set cache ID if (!CacheCheck()) { $box->caching = 0; $box_search = $box->fetch(CURRENT_TEMPLATE . '/boxes/box_search.html'); } else { $box->caching = 1; $box->cache_lifetime = CACHE_LIFETIME; $box->cache_modified_check = CACHE_CHECK; $cache_id = $_SESSION['language'];
if (isset($q) && vam_not_null($q)) { $searchwords = explode(" ", $q); $nosearchwords = sizeof($searchwords); foreach ($searchwords as $key => $value) { if ($value == '') { unset($searchwords[$key]); } } $searchwords = array_values($searchwords); $nosearchwords = sizeof($searchwords); foreach ($searchwords as $key => $value) { $booltje = '+' . $searchwords[$key] . '*'; $searchwords[$key] = $booltje; } $q = implode(" ", $searchwords); $products_query = vam_db_query("select pd.products_id, pd.products_name, pd.products_keywords, p.products_model, p.products_image\n\t\t\t\t\t\t\tfrom " . TABLE_PRODUCTS_DESCRIPTION . " pd\n\t\t\t\t\t\t\tinner join " . TABLE_PRODUCTS . " p\n\t\t\t\t\t\t\ton (p.products_id = pd.products_id)\n\t\t\t\t\t\t\twhere (match (pd.products_name) against ('" . $q . "' in boolean mode)\n\t\t\t\t\t\t\tor match (p.products_model) against ('" . $q . "' in boolean mode) or match (pd.products_keywords) against ('" . $q . "' in boolean mode)" . ($_REQUEST['search_in_description'] == '1' ? "or match (pd.products_description) against ('" . $q . "' in boolean mode)" : "") . ")\n\t\t\t\t\t\t\tand p.products_status = '1'\n\t\t\t\t\t\t\tand pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n\t\t\t\t\t\t\torder by pd.products_name asc\n\t\t\t\t\t\t\tlimit " . AJAX_QUICKSEARCH_LIMIT); if (vam_db_num_rows($products_query)) { //$out .= sprintf(TEXT_AJAX_QUICKSEARCH_TOP, AJAX_QUICKSEARCH_LIMIT) . '<br />'; $dropdown = array(); $out .= '<ul class="ajaxQuickFind">'; while ($products = vam_db_fetch_array($products_query)) { $out .= '<li class="ajaxQuickFind"><div class="search_img"><img src="images/product_images/thumbnail_images/' . $products['products_image'] . '" height="60"/></div><div class="search_href"><a href="' . vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products['products_id'], $products['products_name']), 'NONSSL', false) . '">' . $products['products_name'] . '</a></div></li>' . "\n"; $dropdown[] = array('id' => $products['products_id'], 'text' => $products['products_name']); } $out .= '</ul>' . "\n"; if (AJAX_QUICKSEARCH_RESULT == 'dropdown') { $out .= vam_draw_pull_down_menu('AJAX_QUICKSEARCH_pid', $dropdown, '', 'onChange="this.form.submit();" size="' . AJAX_QUICKSEARCH_DROPDOWN_SIZE . '" class="ajaxQuickFind"') . vam_hide_session_id(); } } } echo $out;
Copyright (c) 2007 VaM Shop ----------------------------------------------------------------------------------------- based on: (c) 2006 Andrew Berezin (ajaxAddQuickie.php,v 1.9 2003/08/17); zen-cart.com Released under the GNU General Public License ---------------------------------------------------------------------------------------*/ //var_dump($_POST);echo '<br>'; define("AJAX_ADDQUICK_RESULT", 'text'); // dropdown or text define("AJAX_ADDQUICK_DROPDOWN_SIZE", 5); define("AJAX_ADDQUICK_LIMIT", 15); $q = addslashes(preg_replace("%[^0-9a-zA-Zа-яА-Я\\s]%iu", "", $_REQUEST['quickie'])); $out = ""; if (isset($q) && vam_not_null($q)) { $model_query = vam_db_query("select pd.products_id, pd.products_name, p.products_model\n\t\t\t\t\t\t\tfrom " . TABLE_PRODUCTS_DESCRIPTION . " pd\n\t\t\t\t\t\t\tinner join " . TABLE_PRODUCTS . " p\n\t\t\t\t\t\t\ton (p.products_id = pd.products_id)\n\t\t\t\t\t\t\twhere p.products_model like '%" . $q . "%' \n\t\t\t\t\t\t\tand p.products_status = '1'\n\t\t\t\t\t\t\tand pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n\t\t\t\t\t\t\torder by pd.products_name asc\n\t\t\t\t\t\t\tlimit " . AJAX_ADDQUICK_LIMIT); if (vam_db_num_rows($model_query)) { $out .= sprintf(TEXT_AJAX_ADDQUICKIE_SEARCH_TOP, AJAX_ADDQUICK_LIMIT) . '<br />'; $dropdown = array(); $out .= '<ul class="ajaxAddQuickie">'; while ($model = vam_db_fetch_array($model_query)) { $out .= '<li class="ajaxAddQuickie"><a href="' . vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($model['products_id'], $model['products_name']), 'NONSSL', false) . '">' . $model['products_name'] . '</a></li>' . "\n"; $dropdown[] = array('id' => $model['products_id'], 'text' => $model['products_name']); } $out .= '</ul>' . "\n"; if (AJAX_ADDQUICK_RESULT == 'dropdown') { $out .= vam_draw_pull_down_menu('AJAX_ADDQUICK_pid', $dropdown, '', 'onChange="this.form.submit();" size="' . AJAX_ADDQUICK_DROPDOWN_SIZE . '" class="ajaxAddQuickie"') . vam_hide_session_id(); } } } echo $out;
}*/ $manufacturers_list .= '<a href="' . vam_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br />'; } $manufacturers_list .= '</tr></table>'; $box_content = $manufacturers_list; } else { // Display a drop-down $manufacturers_array = array(); if (MAX_MANUFACTURERS_LIST < 2) { $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT); } while ($manufacturers = vam_db_fetch_array($manufacturers_query, true)) { $manufacturers_name = utf8_strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN ? utf8_substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']; $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers_name); } $box_content = vam_draw_form('manufacturers', vam_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get') . vam_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $_GET['manufacturers_id'], 'onchange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '"') . vam_hide_session_id() . '</form>'; } if ($box_content != '') { $box->assign('BOX_CONTENT', $box_content); } } // set cache ID if (!$cache) { $box_manufacturers = $box->fetch(CURRENT_TEMPLATE . '/boxes/box_manufacturers.html'); } else { $box_manufacturers = $box->fetch(CURRENT_TEMPLATE . '/boxes/box_manufacturers.html', $cache_id); } /* if (vam_db_num_rows($manufacturers_query, true) > 0) { $vamTemplate->assign('box_MANUFACTURERS', $box_manufacturers); }
$authors_name = utf8_strlen($authors['authors_name']) > MAX_DISPLAY_AUTHOR_NAME_LEN ? utf8_substr($authors['authors_name'], 0, MAX_DISPLAY_AUTHOR_NAME_LEN) . '..' : $authors['authors_name']; if (isset($_GET['authors_id']) && $_GET['authors_id'] == $authors['authors_id']) { $authors_name = '<b>' . $authors_name . '</b>'; } $authors_list .= '<a href="' . vam_href_link(FILENAME_ARTICLES, 'authors_id=' . $authors['authors_id'] . $SEF_parameter_author) . '">' . $authors_name . '</a><br>'; } $authors_list = utf8_substr($authors_list, 0, -4); $content_string .= $authors_list; } else { // Display a drop-down $authors_array = array(); if (MAX_AUTHORS_LIST < 2) { $authors_array[] = array('id' => '0', 'text' => PULL_DOWN_DEFAULT); } while ($authors = vam_db_fetch_array($authors_query, true)) { $authors_name = utf8_strlen($authors['authors_name']) > MAX_DISPLAY_AUTHOR_NAME_LEN ? utf8_substr($authors['authors_name'], 0, MAX_DISPLAY_AUTHOR_NAME_LEN) . '..' : $authors['authors_name']; $authors_array[] = array('id' => $authors['authors_id'], 'text' => $authors_name); } $content_string .= vam_draw_form('authors', vam_href_link(FILENAME_ARTICLES, '', 'NONSSL', false), 'get') . vam_draw_pull_down_menu('authors_id', $authors_array, isset($_GET['authors_id']) ? $_GET['authors_id'] : '', 'onchange="this.form.submit();" size="' . MAX_AUTHORS_LIST . '" style="width: 100%"') . vam_hide_session_id() . '</form>'; } } $box->assign('BOX_CONTENT', $content_string); } if (!$cache) { $box_authors = $box->fetch(CURRENT_TEMPLATE . '/boxes/box_authors.html'); } else { $box_authors = $box->fetch(CURRENT_TEMPLATE . '/boxes/box_authors.html', $cache_id); } if (vam_db_num_rows($authors_query, true) > 0) { $vamTemplate->assign('box_AUTHORS', $box_authors); }
function vam_get_filter_string($display_type, $filters_select_array, $target, $filter_name, $filter_value) { $filter_name = (string) $filter_name; if (is_array($filter_value)) { } else { $filter_value = (string) $filter_value; } $exclude_array = array($filter_name, 'page'); $additional_variables = vam_get_hidden_get_variables($exclude_array); $box_text = ''; switch ($display_type) { case 'pulldown': $box_text .= vam_draw_form('filter', $target, 'get'); $box_text .= vam_draw_pull_down_menu($filter_name, $filters_select_array, $filter_value, 'onChange="this.form.submit();"'); $box_text .= $additional_variables . vam_hide_session_id(); $box_text .= '<noscript>' . vam_image_submit('submit.png', TEXT_FIND_PRODUCTS) . '</noscript>'; $box_text .= '</form>'; break; case 'radio': $box_text .= vam_draw_form('filter', $target, 'get'); foreach ($filters_select_array as $filter) { $checked = $filter['id'] == $filter_value ? true : false; switch (true) { case $filter['count'] != '' && $filter['count'] < 1 && SPECIFICATIONS_FILTER_NO_RESULT == 'none': break; case $filter['count'] != '' && $filter['count'] < 1 && SPECIFICATIONS_FILTER_NO_RESULT == 'grey': /* $box_text .= '<input type="radio" name="0" value="0" disabled="disabled">'; $box_text .= '<span class="no_results">' . ' '; $box_text .= vam_output_string ($filter['text'] ); $box_text .= '</span>'; if (SPECIFICATIONS_FILTER_SHOW_COUNT == 'True' && $filter['count'] != '') { $box_text .= '<span class="filter_count"> (' . $filter['count'] . ')</span>'; } $box_text .= '<br>' . "\n"; */ break; default: $box_text .= vam_draw_radio_field($filter_name, $filter['id'], $checked, 'onClick="this.form.submit();"') . ' ' . $filter['text']; if (SPECIFICATIONS_FILTER_SHOW_COUNT == 'True' && $filter['count'] != '') { $box_text .= '<span class="filter_count"> (' . $filter['count'] . ')</span>'; } $box_text .= '<br>' . "\n"; break; } // switch (true) } $box_text .= $additional_variables . vam_hide_session_id(); $box_text .= '<noscript>' . vam_image_submit('submit.png', TEXT_FIND_PRODUCTS) . '</noscript>'; $box_text .= '</form>'; break; case 'text': $value = $filter_value != 0 ? $filter_value : ''; $box_text .= vam_draw_form('filter', $target, 'get'); //$box_text .= vam_draw_input_field($filter_name, $value); $box_text .= vam_draw_input_price_slider($filter_name, $value); $box_text .= $additional_variables . vam_hide_session_id(); //$box_text .= '<noscript>' . vam_image_submit('submit.png', TEXT_FIND_PRODUCTS) . '</noscript>'; $box_text .= '</form>'; break; case 'multi': $box_text .= vam_draw_form('filter', $target, 'get'); $box_text .= vam_draw_multi_pull_down_menu($filter_name . '[]', $filters_select_array, $filter_value, 'multiple="' . $filter_name . 'f"'); $box_text .= $additional_variables . vam_hide_session_id(); $box_text .= vam_image_submit('submit.png', TEXT_FIND_PRODUCTS); $box_text .= '</form>'; break; case 'checkbox': $box_text .= vam_draw_form('filter', $target, 'get'); $checkbox_id = 0; foreach ($filters_select_array as $filter) { $checked = $filter['id'] == $filter_value[$checkbox_id] ? true : false; switch (true) { case $filter['count'] < 1 && SPECIFICATIONS_FILTER_NO_RESULT == 'none': break; case $filter['count'] < 1 && SPECIFICATIONS_FILTER_NO_RESULT == 'grey': /* $box_text .= '<input type="checkbox" name="0" value="0" disabled="disabled">'; $box_text .= '<span class="no_results">' . ' '; $box_text .= vam_output_string ($filter['text'] ); $box_text .= '</span>'; if (SPECIFICATIONS_FILTER_SHOW_COUNT == 'True') { $box_text .= '<span class="filter_count"> (' . $filter['count'] . ')</span>'; } $box_text .= '<br>' . "\n"; */ break; default: $box_text .= vam_draw_checkbox_field($filter_name . '[' . $checkbox_id . ']', $filter['id'], $checked, 'onclick="this.form.submit();"') . ' ' . $filter['text']; if (SPECIFICATIONS_FILTER_SHOW_COUNT == 'True') { $box_text .= '<span class="filter_count"> (' . $filter['count'] . ')</span>'; } $box_text .= '<br>' . "\n"; break; } // switch (true) $checkbox_id++; } $box_text .= $additional_variables . vam_hide_session_id(); //$box_text .= vam_image_submit('submit.png', TEXT_FIND_PRODUCTS); $box_text .= '</form>'; break; case 'image': $value = $filter_value != 0 ? $filter_value : ''; $box_text .= vam_draw_images_menu($filter_name, $filters_select_array, $target, $value); break; case 'multiimage': $box_text .= vam_draw_form('filter', $target, 'get'); foreach ($filters_select_array as $filter) { $checked = $filter['id'] == $filter_value[$checkbox_id] ? true : false; $box_text .= vam_draw_checkbox_field($filter_name . '[' . $checkbox_id . ']', $filter['id'], $checked); $box_text .= ' ' . vam_image(DIR_WS_IMAGES . trim($filter['text']), $filter['text']) . '<br>' . "\n"; $box_text .= '<br>' . "\n"; $checkbox_id++; } $box_text .= $additional_variables . vam_hide_session_id(); $box_text .= vam_image_submit('submit.png', TEXT_FIND_PRODUCTS); $box_text .= '</form>'; break; case 'links': default: $box_text .= vam_draw_links_menu($filter_name, $filters_select_array, $target, $filter_value); break; } // switch ($display_type return $box_text; }
(c) 2004 xt:Commerce (advanced_search.php,v 1.13 2003/08/21); xt-commerce.com Released under the GNU General Public License ---------------------------------------------------------------------------------------*/ include 'includes/application_top.php'; // create template elements $vamTemplate = new vamTemplate(); // include boxes require DIR_FS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/source/boxes.php'; // include needed functions require_once DIR_FS_INC . 'vam_get_categories.inc.php'; require_once DIR_FS_INC . 'vam_get_manufacturers.inc.php'; require_once DIR_FS_INC . 'vam_checkdate.inc.php'; $breadcrumb->add(NAVBAR_TITLE_ADVANCED_SEARCH, vam_href_link(FILENAME_ADVANCED_SEARCH)); require DIR_WS_INCLUDES . 'header.php'; $vamTemplate->assign('FORM_ACTION', vam_draw_form('advanced_search', vam_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get', 'onsubmit="return check_form(this);"') . vam_hide_session_id()); $vamTemplate->assign('INPUT_KEYWORDS', vam_draw_input_field('keywords', '', '')); $vamTemplate->assign('HELP_LINK', 'javascript:popupWindow(\'' . vam_href_link(FILENAME_POPUP_SEARCH_HELP) . '\')'); $vamTemplate->assign('BUTTON_SUBMIT', vam_image_submit('search.png', IMAGE_BUTTON_SEARCH)); $vamTemplate->assign('SELECT_CATEGORIES', vam_draw_pull_down_menu('categories_id', vam_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES))))); $vamTemplate->assign('ENTRY_SUBCAT', vam_draw_checkbox_field('inc_subcat', '1', true)); $vamTemplate->assign('SELECT_MANUFACTURERS', vam_draw_pull_down_menu('manufacturers_id', vam_get_manufacturers(array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS))))); $vamTemplate->assign('SELECT_PFROM', vam_draw_input_field('pfrom')); $vamTemplate->assign('SELECT_PTO', vam_draw_input_field('pto')); $error = ''; if (isset($_GET['errorno'])) { if (($_GET['errorno'] & 1) == 1) { $error .= str_replace('\\n', '<br />', JS_AT_LEAST_ONE_INPUT); } if (($_GET['errorno'] & 10) == 10) { $error .= str_replace('\\n', '<br />', JS_INVALID_FROM_DATE);