* Easyshop is a web shop system */ include_once './core/search.class.php'; include_once './core/itemsearch.class.php'; class website_search { public $base_object; public $layout_object; public function __construct($base_object, $layout_object) { $this->base_object = $base_object; $this->layout_object = $layout_object; } function run() { $search = $_GET['search']; if (isset($_GET['type']) && $_GET['type'] == 'shoppingcart') { $items = Search::items($search, 1); $this->layout_object->assign('item_hits', $items['hits']); $this->layout_object->assign('item_search', $items['results']); return $this->layout_object->_fetch('shoppingcart_search.tpl'); } else { if (isset($_GET['item_category']) && $_GET['item_category'] > 0) { $items = Search::category_items($search, $_GET['item_category'], 1); $item_result = array(); $c = 0; foreach ($items['results'] as $item) { $c++; if (($c % 2) == 0) { $item->cl = 1; } $item_result[] = $item; } $this->layout_object->assign('item_hits', $items['hits']); $this->layout_object->assign('item_search', $item_result); $manufacturers = Search::manufacturers($search); $this->layout_object->assign('manufacturer_hits', $manufacturers['hits']); $this->layout_object->assign('manufacturer_search', $manufacturers['results']); return $this->layout_object->_fetch('live_search.tpl'); } else { $ItemsClass = new ItemSearch($this->base_object); $result = $ItemsClass->searchItems($search); $this->layout_object->assign('item_search', $result); return $this->layout_object->_fetch('live_search_new.tpl'); } } } }