Категории
[FAQ] Часто задаваемые вопросы и ответы
Проблемы и решения
Ошибки и исправления
Общие вопросы
Расширения
Установка и обновление
Модули
Шаблоны
Локализация интерфейса
Коммерческие предложения
Учимся бизнесу
Бизнес книги
Поисковая оптимизация (SEO)
Магазины на ShopOS
Хостинг для ShopOS
Предложения и пожелания
Курилка
|
Как добавить картинку товара в AJAX поиск
<?php
defined('_VALID_OS') or die('Direct Access to this location is not allowed.');
define("AJAX_QUICKSEARCH_RESULT", 'text'); // dropdown or text define("AJAX_QUICKSEARCH_DROPDOWN_SIZE", 5); define("AJAX_QUICKSEARCH_LIMIT", 15);
$q = addslashes(preg_replace("%%iu", "", $_REQUEST['keywords']) );
$out = ""; if(isset($q) && os_not_null($q)) {
$searchwords = explode(" ",$q); $nosearchwords = sizeof($searchwords); foreach($searchwords as $key => $value) { if ($value == '') unset($searchwords); } $searchwords = array_values($searchwords); $nosearchwords = sizeof($searchwords); foreach($searchwords as $key => $value) { $booltje = '+' . $searchwords . '*'; $searchwords = $booltje; } $q = implode(" ",$searchwords);
$products_query = os_db_query("select pd.products_id, pd.products_name, pd.products_keywords, p.products_model, p.products_image from " . TABLE_PRODUCTS_DESCRIPTION . " pd inner join " . TABLE_PRODUCTS . " p on (p.products_id = pd.products_id) where (match (pd.products_name) against ('" . $q . "' in boolean mode) or 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)" : "") . ") and p.products_status = '1' and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' order by pd.products_name asc limit " . AJAX_QUICKSEARCH_LIMIT);
if(os_db_num_rows($products_query)) { $out .= sprintf(TEXT_AJAX_QUICKSEARCH_TOP, AJAX_QUICKSEARCH_LIMIT) . '<br />'; $dropdown = array(); $out .= '<ul class="ajaxQuickFind">'; while($products = os_db_fetch_array($products_query)) { if ($products['products_image']==''){ $image = DIR_WS_INFO_IMAGES.'../noimage.gif'; }else{ $image = DIR_WS_INFO_IMAGES.$products['products_image']; } $out .= '<li class="ajaxQuickFind"><a href="' . os_href_link(FILENAME_PRODUCT_INFO, os_product_link($products['products_id'], $products['products_name']), 'NONSSL', false) . '"><img style="height:100px;" class="ajaximg" src="' . $image . '"/>' . $products['products_name'] . '</a></li>' . "\n"; $dropdown[] = array('id' => $products['products_id'], 'text' => $products['products_name']); } $out .= '</ul>' . "\n"; if(AJAX_QUICKSEARCH_RESULT == 'dropdown') { $out .= os_draw_pull_down_menu('AJAX_QUICKSEARCH_pid', $dropdown, '', 'onChange="this.form.submit();" size="' . AJAX_QUICKSEARCH_DROPDOWN_SIZE . '" class="ajaxQuickFind"') . os_hide_session_id(); } } } $_RESULT['ajaxQuickFind'] = $out; ?>
пример : www.good-torg.com.ua
The next day I read this quote.
Источник
|