Jump to content
b.tsvetkov

[SOLVED] How to search customers by phone mobile

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 1

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

Glad to help. Please edit your first post and add [sOLVED] to the title.

Share this post


Link to post
Share on other sites

It doesn't work on PrestaShop 1.6.1.7. After update the fields with phone number disappeared. Any solution for this problem?

Thank You!

Share this post


Link to post
Share on other sites

It doesn't work on PrestaShop 1.6.1.7. After update the fields with phone number disappeared. Any solution for this problem?


Thank You!


Share this post


Link to post
Share on other sites

I'm new with using this override but I can't get it working in PrestaShop 1.6.1.12. Is there something changed in the past few versions?

Share this post


Link to post
Share on other sites

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

Does anyone has this code? Original one from post is with [spam filter] because it was too long probably.

Share this post


Link to post
Share on other sites
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

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
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
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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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