Very simple AJAX live search Installation Step by Step (for Shops which use a different theme or many extensions) ---------------------------------------------------------------------------------------------------------- Copy the files from upload to your OpenCart root directory. If you have a different template then the standard one, copy the CSS File in the folder /catalog/view/theme/default/stylesheet/ to your theme path like /catalog/view/theme/myspecialtheme/stylesheet/ Open | Says which file to open Find | Search in this file for this string Add before | Put the code directly before the string descriped in Find Add after | Put the code directly after the string descriped in Find ========================================================================================================== Open: catalog/view/theme/your_theme/template/common/footer.tpl Find: Add before: ========================================================================================================== Open: catalog/view/theme/your_theme/template/common/header.tpl Find: Add after: ========================================================================================================== Open: catalog/controller/product/search.php Find: } ?> Add before: public function ajax() { // Contains results $data = array(); if( isset($this->request->get['keyword']) ) { // Parse all keywords to lowercase $keywords = strtolower( $this->request->get['keyword'] ); // Perform search only if we have some keywords if( strlen($keywords) >= 3 ) { $parts = explode( ' ', $keywords ); $add = ''; // Generating search foreach( $parts as $part ) { $add .= ' AND (LOWER(pd.name) LIKE "%' . $this->db->escape($part) . '%"'; $add .= ' OR LOWER(p.model) LIKE "%' . $this->db->escape($part) . '%")'; } $add = substr( $add, 4 ); $sql = 'SELECT pd.product_id, pd.name, p.model FROM ' . DB_PREFIX . 'product_description AS pd '; $sql .= 'LEFT JOIN ' . DB_PREFIX . 'product AS p ON p.product_id = pd.product_id '; $sql .= 'LEFT JOIN ' . DB_PREFIX . 'product_to_store AS p2s ON p2s.product_id = pd.product_id '; $sql .= 'WHERE ' . $add . ' AND p.status = 1 '; $sql .= 'AND pd.language_id = ' . (int)$this->config->get('config_language_id'); $sql .= ' AND p2s.store_id = ' . (int)$this->config->get('config_store_id'); $sql .= ' LIMIT 15'; $res = $this->db->query( $sql ); if( $res ) { $data = ( isset($res->rows) ) ? $res->rows : $res->row; // For the seo url stuff $this->load->model('tool/seo_url'); $basehref = HTTP_SERVER . 'index.php?route=product/product&keyword=' . $this->request->get['keyword'] . '&product_id='; foreach( $data as $key => $values ) { $data[$key] = array( 'name' => htmlspecialchars_decode($values['name'] . ' (' . $values['model'] . ')', ENT_QUOTES), 'href' => $this->model_tool_seo_url->rewrite($basehref . $values['product_id']) ); } } } } echo json_encode( $data ); }