Jump to content

[SOLVED] How to search customers by phone mobile


b.tsvetkov
 Share

Recommended Posts

Hallo

I'am using PrestaShop 1.6.

Is it possible to search customers in customers page by their phone numbers. I tryed this way https://www.prestashop.com/forums/topic/325175-how-do-i-search-customer-by-their-phone-number-in-the-back-office/ , but it doesn't work.

Please, help!

Thank you!

Edited by b.tsvetkov (see edit history)

Share this post


Link to post
Share on other sites

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');       [spam-filter]

Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button after creating the file.

  • Like 3

Share this post


Link to post
Share on other sites

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');       [spam-filter]

Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button after creating the file.

Great, it's working!

Thank you so much!

  • Like 1

Share this post


Link to post
Share on other sites

  • 3 months later...
  • 7 months later...

Delete the /cache/class_index.php file.

 

As it is stated in /override/readme_override.txt:

 

Hello,

 
Please read the documentation before trying to override something here.
 
Frequently Asked Questions
 
Q: I added an override file but it seems to be ignored by PrestaShop
A: You need to trigger the regeneration of the /cache/class_index.php file. This is done simply by deleting the file. It is the same when manually removing an override: in order to reinstate the default behavior, you must delete the /cache/class_index.php file.
 

 

Worked, fine for me in 1.6.1.12

Share this post


Link to post
Share on other sites

  • 6 months later...
  • 1 month later...
  • 2 months later...
On 6/11/2016 at 2:53 PM, rocky said:

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');       [spam-filter]

Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button after creating the file.

Not working. [spam filter] locked the code

Share this post


Link to post
Share on other sites

  • 2 weeks later...

The code missed just 2 curly brackets, the correct code is:

<?php
class 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');
  }
}

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

  • 2 months later...
On 3/31/2018 at 12:13 PM, zod said:

The code missed just 2 curly brackets, the correct code is:

<?php
class 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');
  }
}

 

This code works in PS 1.6.16!

 

Thanks a lot @zod

Edited by Coloranti (see edit history)

Share this post


Link to post
Share on other sites

  • 7 months later...
On 3/31/2018 at 12:13 PM, zod said:

The code missed just 2 curly brackets, the correct code is:

<?php
class 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');
  }
}

 

It works for 1.7.2.2 as well. Thank you!

 

  • Like 1

Share this post


Link to post
Share on other sites

  • 3 months later...

Works fine at 1.7.5.2 :)

Added search for VAT and customer comments

<?php

class AdminAddressesController extends AdminAddressesControllerCore
{
    public function __construct()
    {
        parent::__construct();
        
        $this->fields_list['phone'] = array('title' => $this->l('phonr'), 'filter_key' => 'a!phone');   
        $this->fields_list['phone_mobile'] = array('title' => $this->l('mobile'), 'filter_key' => 'a!phone_mobile'); 
        $this->fields_list['other'] = array('title' => $this->l('comments'), 'filter_key' => 'a!other');
      $this->fields_list['vat_number'] = array('title' => $this->l('VAT'), 'filter_key' => 'a!vat_number');    
    }
}

Share this post


Link to post
Share on other sites

  • 4 months later...
  • 4 weeks later...
  • 4 months later...
On 11/26/2019 at 1:33 PM, MANB Design said:

in AdminOrdersController????? THX

 

On 10/31/2019 at 6:48 PM, depurweb said:

can i add this fuction on AdminCustomers?

I also searching for solution about orders and customers pages... Did you find anything?

Share this post


Link to post
Share on other sites

  • 4 months later...
On 6/11/2016 at 2:53 PM, rocky said:

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');       [spam-filter]

Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button after creating the file.

This works with Prestashop 1.7.6.7 as well. Awsome job!

Share this post


Link to post
Share on other sites

  • 4 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More