Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Создайте дополнительную характеристику Производитель. В расширенном поиске добавьте фильтр по этой доп.характеристике.как в wss добавить поиск/фильтр по производителям?
function prdSearchProductByTemplate($callBackParam, &$count_row, $navigatorParams = null){
$limit = $navigatorParams != null?' LIMIT '.(int)$navigatorParams['offset'].','.(int)$navigatorParams['CountRowOnPage']:'';
$where_clause = '';
$where_sku_clause = '';
$_sqlParams = array();
if ( isset($callBackParam['search_simple']) ){
if (!count($callBackParam['search_simple'])){ //empty array
$where_clause = ' WHERE 0';
}else{ //search array is not empty
$_count = 0;
foreach( $callBackParam['search_simple'] as $value ){
//check if $value is a word in plural, e.g. flowers, bags, players
//in this case we should get rid of 's' at the end to make search more efficient
if (mb_strlen($value,'UTF-8')>3 && $value{ mb_strlen($value,'UTF-8')-1 } == 's'){
$value = mb_substr( $value, 0, mb_strlen($value,'UTF-8')-1,'UTF-8');
}
$value = mb_strtolower($value,'UTF-8');
if(!strlen($value))continue;
//$value = preg_replace(array('/([\/]{1})\+/','/(^|[^\/]{1})\+/'),array('+',' '),$value);
//$sql_value = xEscapeSQLstring($value);
$search_name = 'search_simple_'.($_count++);
$_sqlParams[$search_name] = '%'._searchPatternReplace($value).'%';
$where_clause .= ($where_clause?' AND':'').' ( LOWER('.LanguagesManager::sql_prepareField('name').') LIKE ?'.$search_name.' OR
LOWER('.LanguagesManager::sql_prepareField('description').') LIKE ?'.$search_name.' OR
LOWER('.LanguagesManager::sql_prepareField('brief_description').') LIKE ?'.$search_name.') ';
if(defined('CONF_ENABLE_PRODUCT_SKU')&&constant('CONF_ENABLE_PRODUCT_SKU')){
$where_sku_clause .= ($where_sku_clause?' AND':'').' (LOWER(product_code) LIKE ?'.$search_name.')';
}
}
if($where_sku_clause){
if($where_clause){
$where_clause = "(({$where_clause}) OR ({$where_sku_clause}))";
}else{
$where_clause = $where_sku_clause;
}
}
$where_clause = ' WHERE categoryID<>1 and enabled=1'.($where_clause?' AND '.$where_clause:'');
}
}
else{
if (isset($callBackParam['enabled']))$where_clause.=($where_clause?' AND':'').' enabled='.xEscapeSQLstring($callBackParam['enabled']);
if ( isset($callBackParam['name']) ){
$_count = 0;
$where_clause_name = '';
foreach( $callBackParam['name'] as $name ){
if (!$name)continue;
$search_name = 'search_'.($_count++);
$_sqlParams[$search_name] = '%'._searchPatternReplace($name).'%';
$where_clause_name .= ($where_clause_name?' AND':'').' '.LanguagesManager::sql_prepareField('name').' LIKE ?'.$search_name;
}
if($where_clause_name){
$where_clause .= ($where_clause?' AND':'').' ('.$where_clause_name.')';
}
}
if(isset($callBackParam['product_code'])){
$_count = 0;
$where_clause_code = '';
foreach( $callBackParam['product_code'] as $product_code ){
$search_name = 'product_code'.($_count++);
$_sqlParams[$search_name] = '%'._searchPatternReplace($product_code).'%';
$where_clause_code .= ($where_clause_code?' AND':'').' product_code LIKE ?'.$search_name;
}
if($where_clause_code){
$where_clause .= ($where_clause?' OR':'').' ('.$where_clause_code.')';
}
}
if(isset($callBackParam['price']['from']))$where_clause .= ($where_clause?' AND':'').' '.ConvertPriceToUniversalUnit($callBackParam['price']['from']).'<=Price ';
if(isset($callBackParam['price']['to']))$where_clause .= ($where_clause?' AND':'').' Price<='.ConvertPriceToUniversalUnit($callBackParam['price']['to']).' ';
if(isset($callBackParam['!productID']))$where_clause .= ($where_clause?' AND':'').' productID<>'.xEscapeSQLstring($callBackParam['!productID']).' ';
if ( isset($callBackParam['categoryID'])){
$where_clause = _getConditionWithCategoryConj( $where_clause, $callBackParam['categoryID'], isset($callBackParam['searchInSubcategories'])&&$callBackParam['searchInSubcategories']);
}
$where_clause = $where_clause?'WHERE '.$where_clause:'';
}
$sort_field = 'name';
$order_by_clause = ' ORDER BY sort_order, '.LanguagesManager::sql_getSortField(PRODUCTS_TABLE, $sort_field);
if(isset($callBackParam['sort'])&&in_array($callBackParam['sort'],array('name','brief_description','in_stock','Price','customer_votes','customers_rating',
'list_price','sort_order','items_sold','product_code','shipping_freight'))){
$order_by_clause = ' ORDER BY '.LanguagesManager::sql_getSortField(PRODUCTS_TABLE, $callBackParam['sort']).' ASC ';
if (isset($callBackParam['direction'])&&$callBackParam['direction'] == 'DESC')$order_by_clause = ' ORDER BY '.LanguagesManager::sql_getSortField(PRODUCTS_TABLE, $callBackParam['sort']).' DESC ';
}
/**
* Tags search
*/
$left_join = '';
$group_by = '';
if(isset($callBackParam['search_tags'])){
$where_tags = '';
foreach($callBackParam['search_tags'] as $value ){
/**
* check if $value is a word in plural, e.g. flowers, bags, players
* in this case we should get rid of 's' at the end to make search more efficient
*/
if (strlen($value)>3 && $value{ strlen($value)-1 } == 's'){
$value = substr( $value, 0, strlen($value)-1 );
}
if (!$value)continue;
$value = mb_strtolower($value,'UTF-8');
//$value = xEscapeSQLstring($value);
$search_name = 'search_tags'.($_count++);
$_sqlParams[$search_name] = '%'._searchPatternReplace($value).'%';
$where_tags .= ($where_tags?' OR':'').' LOWER(t1.name) LIKE ?'.$search_name;
}
if($where_tags){
$left_join = '
LEFT JOIN ?#TAGGED_OBJECTS_TBL t2 ON p.productID=t2.object_id
LEFT JOIN ?#TAGS_TBL t1 ON t2.tag_id=t1.id AND t2.object_type="product"
';
$where_clause = trim(str_replace('WHERE', '', $where_clause));
$where_clause = 'WHERE ( ('.$where_tags.') AND categoryID<>1 AND enabled=1)'.($where_clause?' OR ('.$where_clause.')':'');
$group_by = ' GROUP BY p.productID';
}
}
/**
* Seach by extra parameters
*/
if(isset($callBackParam['extraParametrsTemplate'])){
$_sqls = _prepareSearchExtraParameters($callBackParam['extraParametrsTemplate']);
if(count($_sqls['where'])){
$left_join = implode(' ', $_sqls['join']);
$where_clause = trim(str_replace('WHERE', '', $where_clause));
$where_clause = 'WHERE '.($where_clause?'('.$where_clause.') AND ':'').'('.implode(') AND (',$_sqls['where']).')';
$group_by = ' GROUP BY p.productID';
}
$_sqlParams = array_merge($_sqlParams,$_sqls['params']);
}
$dbq = 'SELECT COUNT(DISTINCT p.productID) as cnt FROM '.PRODUCTS_TABLE.' p '.$left_join.$where_clause;
$count_row = db_phquery_fetch(DBRFETCH_FIRST,$dbq,$_sqlParams);
if(isset($navigatorParams['offset'])&&$count_row<$navigatorParams['offset']){
$navigatorParams['offset'] = $navigatorParams['CountRowOnPage']*intval($count_row/$navigatorParams['CountRowOnPage']);
}
$limit = $navigatorParams != null?' LIMIT '.(int)$navigatorParams['offset'].','.(int)$navigatorParams['CountRowOnPage']:'';
$dbq = 'SELECT p.*, '.LanguagesManager::sql_constractSortField(PRODUCTS_TABLE, $sort_field).' FROM '.PRODUCTS_TABLE.' p '.$left_join.$where_clause.$group_by.' '.$order_by_clause.$limit;
$Result = db_phquery($dbq,$_sqlParams);
$Products = array();
$ProductsIDs = array();
$Counter = 0;
while ($_Product = db_fetch_assoc($Result)) {
LanguagesManager::ml_fillFields(PRODUCTS_TABLE, $_Product);
if (!$_Product["productID"] && ($_Product[0]>0)) $_Product["productID"] = $_Product[0];
$_Product['PriceWithUnit'] = show_price($_Product['Price']);
$_Product['list_priceWithUnit'] = show_price($_Product['list_price']);
// you save (value)
$_Product['SavePrice'] = show_price($_Product['list_price']-$_Product['Price']);
// you save (%)
if($_Product['list_price'])$_Product['SavePricePercent'] = ceil(((($_Product['list_price']-$_Product['Price'])/$_Product['list_price'])*100));
$_Product['PriceWithOutUnit'] = show_priceWithOutUnit( $_Product['Price'] );
if ( ((float)$_Product['shipping_freight']) > 0 )
$_Product['shipping_freightUC'] = show_price( $_Product['shipping_freight'] );
$ProductsIDs[$_Product['productID']] = $Counter;
$Products[] = $_Product;
$Counter++;
}
$ProductsExtra = GetExtraParametrs(array_keys($ProductsIDs));
foreach ($ProductsExtra as $_ProductID=>$_Extra){
$Products[$ProductsIDs[$_ProductID]]['product_extra'] = $_Extra;
}
_setPictures($Products);
return $Products;
}
Так ведь всё элементарно просто.Не подскажете, что надо подправить, чтобы простой поиск в webasyst'е осуществлялся только по наименованию товара, а не по наименованию, краткому и полному описанию?
Версия у меня 2.81.
Или если вопрос на этом форуме уже решён, - пните, пожалуйста, в ссылку.
$where_clause .= ($where_clause?' AND':'').' ( LOWER('.LanguagesManager::sql_prepareField('name').') LIKE ?'.$search_name.' OR
LOWER('.LanguagesManager::sql_prepareField('description').') LIKE ?'.$search_name.' OR
LOWER('.LanguagesManager::sql_prepareField('brief_description').') LIKE ?'.$search_name.') ';
$where_clause .= ($where_clause?' AND':'').' ( LOWER('.LanguagesManager::sql_prepareField('name').') LIKE ?'.$search_name.') ';
cpt_product_lists list_id='bestseller'
#container_main_content .cpt_product_lists
#container_left_sidebar .cpt_product_lists
У меня такой роботс.Мой файл выглядит так:
User-agent: *
Disallow: /cgi-bin/
Disallow: /tmp/
Disallow: /temp/
Disallow: /en/
при этом яша уже полтора месяца держит в индексе /en/-больше 800страниц
и вот поймал буквально на днях больше четырех сотен страниц
формат которых типа не поддерживается.а страницы эти-отзывы о продукте(причем на этих страницах нет самих отзывов)