ccw0103 Posted April 22, 2014 Share Posted April 22, 2014 So, it would be easier to access the customer by searching the mobile phone number as customer sometimes reluctant to say their full name and they expect I can search through their mobile phone number, how do I do that? Thanks Link to comment Share on other sites More sharing options...
ccw0103 Posted April 23, 2014 Author Share Posted April 23, 2014 anyone? please Link to comment Share on other sites More sharing options...
ccw0103 Posted May 9, 2014 Author Share Posted May 9, 2014 .....anyone Link to comment Share on other sites More sharing options...
ccw0103 Posted May 19, 2014 Author Share Posted May 19, 2014 please Link to comment Share on other sites More sharing options...
ccw0103 Posted May 24, 2014 Author Share Posted May 24, 2014 ????? Link to comment Share on other sites More sharing options...
www.harryfay.co.uk Posted May 24, 2014 Share Posted May 24, 2014 I use SQL for that. In Advanced Parameters -> SQL Manager define new query: select c.id_customer, c.firstname, c.lastname, a.address1, a.address2, a.postcode, a.city,a.postcode, a.phone from ps_customer c, ps_address a where c.id_customer=a.id_customer and a.phone='xxx' Replace xxx with the number you want and execute. Not the most convenient, but it works. 1 Link to comment Share on other sites More sharing options...
ccw0103 Posted May 26, 2014 Author Share Posted May 26, 2014 I use SQL for that. In Advanced Parameters -> SQL Manager define new query: select c.id_customer, c.firstname, c.lastname, a.address1, a.address2, a.postcode, a.city,a.postcode, a.phone from ps_customer c, ps_address a where c.id_customer=a.id_customer and a.phone='xxx' Replace xxx with the number you want and execute. Not the most convenient, but it works. Thanks man, appreciate it. I will take whatever works Link to comment Share on other sites More sharing options...
p00pstar Posted October 1, 2014 Share Posted October 1, 2014 1. Open file "classes/Customer.php" 2. Search for the function named "searchByName" 3. Replace: $sql = 'SELECT * FROM `'._DB_PREFIX_.'customer` WHERE ( `email` LIKE \'%'.pSQL($query).'%\' OR `id_customer` LIKE \'%'.pSQL($query).'%\' OR `lastname` LIKE \'%'.pSQL($query).'%\' OR `firstname` LIKE \'%'.pSQL($query).'%\' )'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); with $sql = 'SELECT c.* FROM '._DB_PREFIX_.'customer c, '._DB_PREFIX_.'address a WHERE (( c.id_customer = a.id_customer AND a.phone LIKE \'%'.pSQL($query).'%\' ) OR c.email LIKE \'%'.pSQL($query).'%\' OR c.id_customer LIKE \'%'.pSQL($query).'%\' OR c.lastname LIKE \'%'.pSQL($query).'%\' OR c.firstname LIKE \'%'.pSQL($query).'%\' )'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); 4. Now you can use the backend search from top left to search for the phone number too. I only did this on 1.6.0.9 so i can't comment on a different version. But it should be similar. 5 Link to comment Share on other sites More sharing options...
KevinNash Posted November 23, 2014 Share Posted November 23, 2014 (edited) Hi, interesting thread How to add phone AND mobile phone search too ? I also saw that the search is very slow after that modification, is that normal ? Edit, I founded why it is so slow, after the modification if you search for an email for example, you'll get infinite results Edited November 24, 2014 by KevinNash (see edit history) Link to comment Share on other sites More sharing options...
p00pstar Posted December 10, 2014 Share Posted December 10, 2014 Here' is the fixed one with mobile phone too: $sql = 'SELECT c.* FROM '._DB_PREFIX_.'customer c, '._DB_PREFIX_.'address a WHERE c.id_customer = a.id_customer AND ( a.phone LIKE \'%'.pSQL($query).'%\' OR a.phone_mobile LIKE \'%'.pSQL($query).'%\' OR c.email LIKE \'%'.pSQL($query).'%\' OR c.id_customer LIKE \'%'.pSQL($query).'%\' OR c.lastname LIKE \'%'.pSQL($query).'%\' OR c.firstname LIKE \'%'.pSQL($query).'%\' )'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); 1 Link to comment Share on other sites More sharing options...
KevinNash Posted December 10, 2014 Share Posted December 10, 2014 Thank you so much for this time saver modification Works like a charm under PS 1.5.4.1 Bow down to you Link to comment Share on other sites More sharing options...
KevinNash Posted December 22, 2014 Share Posted December 22, 2014 Hi, I just saw one thing with the last modification, for some customers ( not all of them, just somes ), there is multiple results for one search : Not really bad but a little bit disturbing, any idea why that happens with the last modification ? Link to comment Share on other sites More sharing options...
KevinNash Posted March 8, 2015 Share Posted March 8, 2015 Another thing : With the modification, if you do a search with an email and if teh customer don't have an adress, the search show 0 results even if the email is good Can you take a look p00pstar ? Link to comment Share on other sites More sharing options...
ccw0103 Posted March 31, 2015 Author Share Posted March 31, 2015 awesome stuff! Link to comment Share on other sites More sharing options...
wilson113311 Posted May 17, 2015 Share Posted May 17, 2015 Could somebody help me if possible? I am wanting to search my orders in the back office by postcode is this possible? Could someone tell me what I need to modify to make this possible? Link to comment Share on other sites More sharing options...
ccw0103 Posted July 6, 2015 Author Share Posted July 6, 2015 in 1.6.14 it now shows blank page any fix??? Link to comment Share on other sites More sharing options...
ccw0103 Posted July 6, 2015 Author Share Posted July 6, 2015 Here' is the fixed one with mobile phone too: $sql = 'SELECT c.* FROM '._DB_PREFIX_.'customer c, '._DB_PREFIX_.'address a WHERE c.id_customer = a.id_customer AND ( a.phone LIKE \'%'.pSQL($query).'%\' OR a.phone_mobile LIKE \'%'.pSQL($query).'%\' OR c.email LIKE \'%'.pSQL($query).'%\' OR c.id_customer LIKE \'%'.pSQL($query).'%\' OR c.lastname LIKE \'%'.pSQL($query).'%\' OR c.firstname LIKE \'%'.pSQL($query).'%\' )'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); it now shows blank page in 1.6 version, any fix??? Link to comment Share on other sites More sharing options...
wilson113311 Posted July 6, 2015 Share Posted July 6, 2015 Can anybody help regards searching admin by customer postcode? Link to comment Share on other sites More sharing options...
vekia Posted July 6, 2015 Share Posted July 6, 2015 customer can use many addresses, so it will be a little hard especially because you can feetch only one "address" and display it there Link to comment Share on other sites More sharing options...
wilson113311 Posted July 6, 2015 Share Posted July 6, 2015 Surely there must be a change in the code so we can pull up orders using there postcode? I may have to look at a different platform if this cannot be made possible? Link to comment Share on other sites More sharing options...
siomosp Posted August 13, 2015 Share Posted August 13, 2015 customer can use many addresses, so it will be a little hard especially because you can feetch only one "address" and display it there Vekia , develop a module for customer search with all possible fields! ( e.g , phone , city , address , etc) I think it should be succesfull 3 Link to comment Share on other sites More sharing options...
sondiva Posted December 1, 2015 Share Posted December 1, 2015 As this given by p00pstar , this code is working in 1.6.1.2, i have tested and had to refresh the page 4 to 5 times, and it works perfectly Here' is the fixed one with mobile phone too: $sql = 'SELECT c.* FROM '._DB_PREFIX_.'customer c, '._DB_PREFIX_.'address a WHERE c.id_customer = a.id_customer AND ( a.phone LIKE \'%'.pSQL($query).'%\' OR a.phone_mobile LIKE \'%'.pSQL($query).'%\' OR c.email LIKE \'%'.pSQL($query).'%\' OR c.id_customer LIKE \'%'.pSQL($query).'%\' OR c.lastname LIKE \'%'.pSQL($query).'%\' OR c.firstname LIKE \'%'.pSQL($query).'%\' )'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); 1 Link to comment Share on other sites More sharing options...
b.tsvetkov Posted June 10, 2016 Share Posted June 10, 2016 As this given by p00pstar , this code is working in 1.6.1.2, i have tested and had to refresh the page 4 to 5 times, and it works perfectly Here' is the fixed one with mobile phone too: $sql = 'SELECT c.* FROM '._DB_PREFIX_.'customer c, '._DB_PREFIX_.'address a WHERE c.id_customer = a.id_customer AND ( a.phone LIKE \'%'.pSQL($query).'%\' OR a.phone_mobile LIKE \'%'.pSQL($query).'%\' OR c.email LIKE \'%'.pSQL($query).'%\' OR c.id_customer LIKE \'%'.pSQL($query).'%\' OR c.lastname LIKE \'%'.pSQL($query).'%\' OR c.firstname LIKE \'%'.pSQL($query).'%\' )'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); Is it work on versiona 1.6.1.5? 1 Link to comment Share on other sites More sharing options...
sondiva Posted June 11, 2016 Share Posted June 11, 2016 As this given by p00pstar , this code is working in 1.6.1.2, i have tested and had to refresh the page 4 to 5 times, and it works perfectly Here' is the fixed one with mobile phone too: $sql = 'SELECT c.* FROM '._DB_PREFIX_.'customer c, '._DB_PREFIX_.'address a WHERE c.id_customer = a.id_customer AND ( a.phone LIKE \'%'.pSQL($query).'%\' OR a.phone_mobile LIKE \'%'.pSQL($query).'%\' OR c.email LIKE \'%'.pSQL($query).'%\' OR c.id_customer LIKE \'%'.pSQL($query).'%\' OR c.lastname LIKE \'%'.pSQL($query).'%\' OR c.firstname LIKE \'%'.pSQL($query).'%\' )'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER); Yes it works fine in 1.6.1.5? Link to comment Share on other sites More sharing options...
siomosp Posted July 6, 2016 Share Posted July 6, 2016 Hello , the solution from this post is much simpler to use! https://www.prestashop.com/forums/topic/534663-solved-how-to-search-customers-by-phone-mobile/ Here's a simple override that adds "Phone" and "Mobile" columns to the Customers > Addresses tab in the Back Office so you can filter by phone or mobile. Create override/controllers/admin/AdminAddressesController.php with the following: <?phpclass AdminAddressesController extends AdminAddressesControllerCore{public function __construct(){parent::__construct();$this->fields_list['phone'] = array('title' => $this->l('Phone'), 'filter_key' => 'a!phone');$this->fields_list['phone_mobile'] = array('title' => $this->l('Mobile'), 'filter_key' => 'a!phone_mobile'); }} Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button after creating the file. 1 Link to comment Share on other sites More sharing options...
TheNstam Posted January 27, 2017 Share Posted January 27, 2017 Can you search both PHONE and MOBILE PHONE with an SQL command such as: select c.id_customer,c.email, c.firstname, c.lastname, a.address1, a.address2, a.postcode, a.city,a.postcode, a.phone from ps_customer c, ps_address a where c.id_customer=a.id_customer and a.phone='xxx' Because I don't have access and I don't wanna mess with code and I'm using this command for almost a year now but it doesn't search for 2nd phone. Thanks in advance! Link to comment Share on other sites More sharing options...
Recommended Posts