Search
| Search: | |
| Search in product descriptions | |
| Search in product model | |
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(name) LIKE "%' . $this->db->escape($part) . '%"'; } $add = substr( $add, 4 ); $sql = 'SELECT pd.product_id, pd.name 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'; // Limit the result $res = $this->db->query( $sql ); if( $res ) { $data = ( isset($res->rows) ) ? $res->rows : $res->row; } } } echo json_encode( $data ); }
Shopping Cart
Brands
Bestsellers
Featured![]() |
تبلت ای پد وای فای
تومان1,500,000 |
![]() |
تبلت ای پد وای فای
تومان1,500,000 |
![]() |
تبلت ای پد وای فای
تومان1,500,000 |
![]() |
موتورولا میلستون
تومان690,000 |
Specials| Search: | |
| Search in product descriptions | |
| Search in product model | |