carlitos666 Posted November 30, 2017 Share Posted November 30, 2017 Bonjour, Dans le BO de prestashop 1.6, j'aimerai pouvoir rechercher un client par le nom de sa société (et éventuellement par le le code postal et pays mais c'est moins urgent) Dans le moteur général du BO et dans la recherche client lorsque l''on créer une nouvelle commande en BO. Merci de vos retours et suggestions Carlitos Link to comment Share on other sites More sharing options...
BeComWeb Posted November 30, 2017 Share Posted November 30, 2017 Bonsoir. Vous voulez pouvoir faire cette recherche dans la liste des commandes ou celle des clients ? Link to comment Share on other sites More sharing options...
carlitos666 Posted December 1, 2017 Author Share Posted December 1, 2017 (edited) J'ai finalement trouvé une solution : dans le fichier classes/customer.php, j'ai ajouté une ligne avec "company" public static function searchByName($query, $limit = null) { $sql_base = 'SELECT * FROM `'._DB_PREFIX_.'customer`'; $sql = '('.$sql_base.' WHERE `email` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')'; $sql .= ' UNION ('.$sql_base.' WHERE `id_customer` = '.(int)$query.' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')'; $sql .= ' UNION ('.$sql_base.' WHERE `lastname` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')'; $sql .= ' UNION ('.$sql_base.' WHERE `firstname` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')'; $sql .= ' UNION ('.$sql_base.' WHERE `company` LIKE \'%'.pSQL($query).'%\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).')'; Edited December 1, 2017 by carlitos666 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now