* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 8033 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminSearch extends AdminTab { public function searchIP($query) { if (!ip2long(trim($query))) return; $this->_list['customers'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT DISTINCT c.* FROM `'._DB_PREFIX_.'customer` c LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.id_customer = c.id_customer LEFT JOIN `'._DB_PREFIX_.'connections` co ON g.id_guest = co.id_guest WHERE co.`ip_address` = \''.ip2long(trim($query)).'\''); } /** * Search a specific string in the products and categories * * @params string $query String to find in the catalog */ public function searchCatalog($query) { global $cookie; $this->_list['products'] = Product::searchByName((int)$cookie->id_lang, $query, 'id_product', 'DESC'); if (!empty($this->_list['products'])) for ($i = 0; $i < count($this->_list['products']); $i++) $this->_list['products'][$i]['nameh'] = str_ireplace($query, ''.Tools::htmlentitiesUTF8($query).'', $this->_list['products'][$i]['name']); $this->_list['categories'] = Category::searchByName((int)$cookie->id_lang, $query); } /** * Search a specific name in the customers * * @params string $query String to find in the catalog */ public function searchCustomer($query) { $this->_list['customers'] = Customer::searchByName($query); } function postProcess() { global $cookie; $query = trim(Tools::getValue('bo_query')); $searchType = (int)Tools::getValue('bo_search_type'); /* Handle empty search field */ if (empty($query)) $this->_errors[] = Tools::displayError('Please fill in search form first.'); else { echo '
'.($i == 0 ? htmlentities($key, ENT_COMPAT, 'utf-8') : ' ').' | '.htmlentities(stripslashes($tab[$i]['value']), ENT_COMPAT, 'utf-8').' |
---|
'.rtrim(getPath($currentIndex.'?tab=AdminCatalog', $category['id_category'], '', $query), ' >').' |
'.$field['title'].' | '; echo '||||||||
---|---|---|---|---|---|---|---|---|
'.$product['id_product'].' | '.($product['manufacturer_name'] != NULL ? stripslashes($product['manufacturer_name']) : '--').' | '.$product['reference'].' | '.stripslashes($product['nameh']).' | '.stripslashes($product['main_category_id']).' | '.Tools::displayPrice($product['price'], $currency).' | '.$product['quantity'].' |