0 ? $m_params['car_make'] : 0; } else { $catid = defined ('catid') ? catid : 0; $car_make = defined ('car_make') ? car_make : 0; //Tools_Http::Get('filter_make',true) } $params = array( 'length' => $rpp, 'offset' => $page, 'order' => 'price asc' ); $fields = array(); if ($catid) { $fields['catid'][1] = $catid; $fields['catid'][2] =$catid; $fields['catid'][3] =$catid; $fields['catid'][4] =$catid; $fields['catid'][5] =$catid; $fields['catid'][6] =$catid; } if ($car_make) { $fields['carid'] = $car_make; } //$fields['status'] = 'visible'; $fields['active'] = 1; if (isset($search) && !empty($search)) { $search = $DB->Escape($search); $phrase_id = $searchClass->getIdByPhrase($search); if($phrase_id) $phraseData = $searchClass->getPhraseDetails($phrase_id); else $phraseData = array(); $search_array=explode(' ',$search); $c=1; foreach($search_array as $string) { $fields['search'][] =trim($string); // if(count($search_array)>1 && $c!=count($search_array)) $fields['title'] .= ' AND LIKE'; // $c++; } } else $search=''; if ($mode == 'newest') { $fields['new'] = 1; } if ($mode == 'sale') { $fields['sale'] = 1; } //$page_client_card = $Page->getPageData(119); $goods = $products -> getList ($fields, $params); $goods_items = $goods['data']; $total_items = $goods['total']; if(!$search) { $category_title = $L->StrT('goods_categories','title', $cat_item['id'], $cat_item['title']); $Template->description = $category_title; } else $category_title = $search; foreach($goods_items as $good) { $title = $L->StrT('goods','title', $good['id'], $good['title']); $k = explode(' ',$title); foreach($k as $kk) { $keywords_all[$kk]=1; } } $keywords = array(); foreach($keywords_all as $key => $val) { if(strlen($key)>2) $keywords[]=$key; } $Template->keywords = implode(' ,',$keywords); $m_return .= '
'; $m_return .= '

'.$category_title.'

'; if (!empty($goods_items)) { $phrases=array(); if(!empty($search_array)) { foreach($search_array as $string) { $query='SELECT phrase FROM searches WHERE `phrase` LIKE "%'.$string.'%" AND `phrase` NOT LIKE "'.implode(' ',$search_array).'" AND found >0 AND searches_count>1 order by RAND() LIMIT 5 '; //echo $query; $row_query = $DB->Exec($query); while(list($phrase) = $DB->FetchRow($row_query)) { if(!in_array($phrase,$phrases)) $phrases[] = $phrase; if(count($phrases)>10) continue; } } } if(count($phrases)>0) { $m_return .= '
'.$L->Str('search_also').': '; foreach($phrases as $phrase) { $link=str_replace(' ','+',$phrase); $m_return .= ''.$phrase.''; } $m_return .='
'; } $m_return .='
'; if(isset($phraseData['products']) && !empty($phraseData['products']) && !$page) foreach($phraseData['products'] as $item) $m_return .= Common_Template::goodsBoxDefault($item,false,$category_title); if (!empty($goods_items) ) { foreach ($goods_items as $item) { $item['search_title'] = $search; $m_return .= Common_Template::goodsBoxDefault($item,false,$category_title); } } if( (isset($phraseData['products']) && !empty($phraseData['products']) && !$page) && !empty($goods_items)) { $m_return .= '

'.$L->Str('No products in this category').'

'; $m_return .= '

'.$L->Str('Browse shop').'

'; } $m_return .= '
'; $m_return .= Tools_Common:: pageSelector ($total_items, $rpp, $page, '', 10); } else { $m_return .= '

'.$L->Str('No products in this category').'

'; $m_return .= '

'.$L->Str('Browse shop').'

'; } $m_return .= '
';