Added country, states in address search results, added constants for the search type
This commit is contained in:
@@ -483,17 +483,29 @@ class AddressCore extends ObjectModel
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getCustomersAddresses($text)
|
||||
public function searchByName($query, $idLang = false)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'address`
|
||||
'SELECT a.`id_address`, a.`firstname`, a.`lastname`, a.`address1`, a.`postcode`, a.`city`,
|
||||
cl.`name` AS `country_name`, s.`name` AS `state_name`
|
||||
FROM `'._DB_PREFIX_.'address` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl
|
||||
ON cl.`id_country` = a.`id_country`
|
||||
LEFT JOIN `'._DB_PREFIX_.'state` s
|
||||
ON s.`id_country` = cl.`id_country`
|
||||
WHERE id_customer > 0 AND
|
||||
(address1 LIKE \'%'.$text.'%\' OR
|
||||
postcode LIKE \'%'.$text.'%\' OR
|
||||
city LIKE \'%'.$text.'%\' OR
|
||||
phone LIKE \'%'.$text.'%\' OR
|
||||
company LIKE \'%'.$text.'%\' OR
|
||||
alias LIKE \'%'.$text.'%\'
|
||||
(a.`address1` LIKE \'%'.$query.'%\' OR
|
||||
a.`postcode` LIKE \'%'.$query.'%\' OR
|
||||
a.`city` LIKE \'%'.$query.'%\' OR
|
||||
a.`phone` LIKE \'%'.$query.'%\' OR
|
||||
a.`company` LIKE \'%'.$query.'%\' OR
|
||||
a.`alias` LIKE \'%'.$query.'%\' OR
|
||||
s.`name` LIKE \'%'.$query.'%\' OR
|
||||
cl.`name` LIKE \'%'.$query.'%\'
|
||||
)
|
||||
');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user