How to Get Customer data by telephone number in Magento2? Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How to get customer phone from order shipping data?Get Customer AddressMagento pro-grammatically save telephone numberRemove 91 in customer telephone number from database tableHow to update customer telephone if customer doesn't have in the billing address?get order, customer, product details in observer magento 2Magento 2 add telephone number in to the customer account creation formMagento 2: How to get a customer by Telephone attribute?Extends Dashboard customer for telephone numberMagento 2 : cannot save customer phone number
Is there a kind of relay only consumes power when switching?
Dating a Former Employee
How to compare two different files line by line in unix?
Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?
Most bit efficient text communication method?
How to tell that you are a giant?
Is "Reachable Object" really an NP-complete problem?
Do jazz musicians improvise on the parent scale in addition to the chord-scales?
Wu formula for manifolds with boundary
Is grep documentation wrong?
What do you call the main part of a joke?
Is safe to use va_start macro with this as parameter?
Do square wave exist?
How to find all the available tools in mac terminal?
Can an alien society believe that their star system is the universe?
Extracting terms with certain heads in a function
What's the meaning of "fortified infraction restraint"?
What is the longest distance a player character can jump in one leap?
また usage in a dictionary
Did MS DOS itself ever use blinking text?
How to answer "Have you ever been terminated?"
Is it common practice to audition new musicians one-on-one before rehearsing with the entire band?
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
Amount of permutations on an NxNxN Rubik's Cube
How to Get Customer data by telephone number in Magento2?
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to get customer phone from order shipping data?Get Customer AddressMagento pro-grammatically save telephone numberRemove 91 in customer telephone number from database tableHow to update customer telephone if customer doesn't have in the billing address?get order, customer, product details in observer magento 2Magento 2 add telephone number in to the customer account creation formMagento 2: How to get a customer by Telephone attribute?Extends Dashboard customer for telephone numberMagento 2 : cannot save customer phone number
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a telephone number which is given in Default address..by using this telephone number i need to get Customer Full data.Data like customer id, customer full name..etc
magento2 customer rest customer-address
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a telephone number which is given in Default address..by using this telephone number i need to get Customer Full data.Data like customer id, customer full name..etc
magento2 customer rest customer-address
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
Address Phone number ? or you created new customer attribute ?
– Pankaj Pareek
Jul 7 '17 at 11:04
Welcome to SE. Try to explain your issue in details also if you have tried any code put in here. It will be much easy to help you.
– Priyank
Jul 7 '17 at 11:11
It is default Billing Address -> Phone number.
– user3374995
Jul 7 '17 at 12:25
Please check the below code and get back with u r feedback thanks
– Nagaraju Kasa
Jul 7 '17 at 12:34
Please let me know whether it's working or not. thanks
– Nagaraju Kasa
Jul 7 '17 at 12:35
add a comment |
I have a telephone number which is given in Default address..by using this telephone number i need to get Customer Full data.Data like customer id, customer full name..etc
magento2 customer rest customer-address
I have a telephone number which is given in Default address..by using this telephone number i need to get Customer Full data.Data like customer id, customer full name..etc
magento2 customer rest customer-address
magento2 customer rest customer-address
edited Jul 7 '17 at 11:21
user3374995
asked Jul 7 '17 at 11:00
user3374995user3374995
718
718
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
Address Phone number ? or you created new customer attribute ?
– Pankaj Pareek
Jul 7 '17 at 11:04
Welcome to SE. Try to explain your issue in details also if you have tried any code put in here. It will be much easy to help you.
– Priyank
Jul 7 '17 at 11:11
It is default Billing Address -> Phone number.
– user3374995
Jul 7 '17 at 12:25
Please check the below code and get back with u r feedback thanks
– Nagaraju Kasa
Jul 7 '17 at 12:34
Please let me know whether it's working or not. thanks
– Nagaraju Kasa
Jul 7 '17 at 12:35
add a comment |
1
Address Phone number ? or you created new customer attribute ?
– Pankaj Pareek
Jul 7 '17 at 11:04
Welcome to SE. Try to explain your issue in details also if you have tried any code put in here. It will be much easy to help you.
– Priyank
Jul 7 '17 at 11:11
It is default Billing Address -> Phone number.
– user3374995
Jul 7 '17 at 12:25
Please check the below code and get back with u r feedback thanks
– Nagaraju Kasa
Jul 7 '17 at 12:34
Please let me know whether it's working or not. thanks
– Nagaraju Kasa
Jul 7 '17 at 12:35
1
1
Address Phone number ? or you created new customer attribute ?
– Pankaj Pareek
Jul 7 '17 at 11:04
Address Phone number ? or you created new customer attribute ?
– Pankaj Pareek
Jul 7 '17 at 11:04
Welcome to SE. Try to explain your issue in details also if you have tried any code put in here. It will be much easy to help you.
– Priyank
Jul 7 '17 at 11:11
Welcome to SE. Try to explain your issue in details also if you have tried any code put in here. It will be much easy to help you.
– Priyank
Jul 7 '17 at 11:11
It is default Billing Address -> Phone number.
– user3374995
Jul 7 '17 at 12:25
It is default Billing Address -> Phone number.
– user3374995
Jul 7 '17 at 12:25
Please check the below code and get back with u r feedback thanks
– Nagaraju Kasa
Jul 7 '17 at 12:34
Please check the below code and get back with u r feedback thanks
– Nagaraju Kasa
Jul 7 '17 at 12:34
Please let me know whether it's working or not. thanks
– Nagaraju Kasa
Jul 7 '17 at 12:35
Please let me know whether it's working or not. thanks
– Nagaraju Kasa
Jul 7 '17 at 12:35
add a comment |
3 Answers
3
active
oldest
votes
Let us $telephone_number is value of current customer's telephone number than you can use $customer and get your data like as:-
$customer->load($telephone_number,'telephone_number');
$customer->getData();
add a comment |
As you have a rest tag , I assume you want to get it via REST API.
You can construct a GET request to <yoursite.com>/rest/<store_code>/V1/customers/search
with the following parameters:
searchCriteria[filterGroups][0][filters][0][field]:
addresses[telephone]
searchCriteria[filterGroups][0][filters][0][value] : 123456789
searchCriteria[filterGroups][0][filters][0][conditionType]: eq
Of course, you've to add admin token on header or you'll likely to get permission denied error.
Reference
add a comment |
Please use the below code in test.php and run the same in the root folder.
<?php
use MagentoFrameworkAppBootstrap;
include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$url = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $url->get('MagentoStoreModelStoreManagerInterface');
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$websiteId = $storeManager->getWebsite()->getWebsiteId();
// Get Store ID
$store = $storeManager->getStore();
$storeId = $store->getStoreId();
$customerFactory = $objectManager->get('MagentoCustomerModelCustomerFactory');
$customer=$customerFactory->create();
$customer->setWebsiteId($websiteId);
//$customer->loadByEmail('roni_cost@example.com');// load customer by email address
//echo $customer->getEntityId();
// $customer->load('1');// load customer by using ID
//$data= $customer->getData();
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // Instance of object manager
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_address_entity');
$sql = "SELECT entity_id FROM `customer_address_entity` WHERE `telephone`='987456123' ";
$result = $connection->fetchAll($sql);
$myCustomerId='';
foreach($result as $key => $value)
$myCustomerId = $value['entity_id'];
$customer->load($myCustomerId);
echo "<pre>";
$data= $customer->getData();
print_r($data);
echo 'Lastname=='.$data['lastname']."</br>";
echo 'DOB=='.$data['dob'];
?>
Screenshot: http://prntscr.com/fss6ql
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f182595%2fhow-to-get-customer-data-by-telephone-number-in-magento2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Let us $telephone_number is value of current customer's telephone number than you can use $customer and get your data like as:-
$customer->load($telephone_number,'telephone_number');
$customer->getData();
add a comment |
Let us $telephone_number is value of current customer's telephone number than you can use $customer and get your data like as:-
$customer->load($telephone_number,'telephone_number');
$customer->getData();
add a comment |
Let us $telephone_number is value of current customer's telephone number than you can use $customer and get your data like as:-
$customer->load($telephone_number,'telephone_number');
$customer->getData();
Let us $telephone_number is value of current customer's telephone number than you can use $customer and get your data like as:-
$customer->load($telephone_number,'telephone_number');
$customer->getData();
answered Jul 7 '17 at 12:57
Jagriti JoshiJagriti Joshi
474
474
add a comment |
add a comment |
As you have a rest tag , I assume you want to get it via REST API.
You can construct a GET request to <yoursite.com>/rest/<store_code>/V1/customers/search
with the following parameters:
searchCriteria[filterGroups][0][filters][0][field]:
addresses[telephone]
searchCriteria[filterGroups][0][filters][0][value] : 123456789
searchCriteria[filterGroups][0][filters][0][conditionType]: eq
Of course, you've to add admin token on header or you'll likely to get permission denied error.
Reference
add a comment |
As you have a rest tag , I assume you want to get it via REST API.
You can construct a GET request to <yoursite.com>/rest/<store_code>/V1/customers/search
with the following parameters:
searchCriteria[filterGroups][0][filters][0][field]:
addresses[telephone]
searchCriteria[filterGroups][0][filters][0][value] : 123456789
searchCriteria[filterGroups][0][filters][0][conditionType]: eq
Of course, you've to add admin token on header or you'll likely to get permission denied error.
Reference
add a comment |
As you have a rest tag , I assume you want to get it via REST API.
You can construct a GET request to <yoursite.com>/rest/<store_code>/V1/customers/search
with the following parameters:
searchCriteria[filterGroups][0][filters][0][field]:
addresses[telephone]
searchCriteria[filterGroups][0][filters][0][value] : 123456789
searchCriteria[filterGroups][0][filters][0][conditionType]: eq
Of course, you've to add admin token on header or you'll likely to get permission denied error.
Reference
As you have a rest tag , I assume you want to get it via REST API.
You can construct a GET request to <yoursite.com>/rest/<store_code>/V1/customers/search
with the following parameters:
searchCriteria[filterGroups][0][filters][0][field]:
addresses[telephone]
searchCriteria[filterGroups][0][filters][0][value] : 123456789
searchCriteria[filterGroups][0][filters][0][conditionType]: eq
Of course, you've to add admin token on header or you'll likely to get permission denied error.
Reference
edited Jul 9 '17 at 19:11
PЯINCƏ
8,44931147
8,44931147
answered Jul 7 '17 at 11:11
PY YickPY Yick
1,815821
1,815821
add a comment |
add a comment |
Please use the below code in test.php and run the same in the root folder.
<?php
use MagentoFrameworkAppBootstrap;
include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$url = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $url->get('MagentoStoreModelStoreManagerInterface');
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$websiteId = $storeManager->getWebsite()->getWebsiteId();
// Get Store ID
$store = $storeManager->getStore();
$storeId = $store->getStoreId();
$customerFactory = $objectManager->get('MagentoCustomerModelCustomerFactory');
$customer=$customerFactory->create();
$customer->setWebsiteId($websiteId);
//$customer->loadByEmail('roni_cost@example.com');// load customer by email address
//echo $customer->getEntityId();
// $customer->load('1');// load customer by using ID
//$data= $customer->getData();
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // Instance of object manager
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_address_entity');
$sql = "SELECT entity_id FROM `customer_address_entity` WHERE `telephone`='987456123' ";
$result = $connection->fetchAll($sql);
$myCustomerId='';
foreach($result as $key => $value)
$myCustomerId = $value['entity_id'];
$customer->load($myCustomerId);
echo "<pre>";
$data= $customer->getData();
print_r($data);
echo 'Lastname=='.$data['lastname']."</br>";
echo 'DOB=='.$data['dob'];
?>
Screenshot: http://prntscr.com/fss6ql
add a comment |
Please use the below code in test.php and run the same in the root folder.
<?php
use MagentoFrameworkAppBootstrap;
include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$url = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $url->get('MagentoStoreModelStoreManagerInterface');
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$websiteId = $storeManager->getWebsite()->getWebsiteId();
// Get Store ID
$store = $storeManager->getStore();
$storeId = $store->getStoreId();
$customerFactory = $objectManager->get('MagentoCustomerModelCustomerFactory');
$customer=$customerFactory->create();
$customer->setWebsiteId($websiteId);
//$customer->loadByEmail('roni_cost@example.com');// load customer by email address
//echo $customer->getEntityId();
// $customer->load('1');// load customer by using ID
//$data= $customer->getData();
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // Instance of object manager
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_address_entity');
$sql = "SELECT entity_id FROM `customer_address_entity` WHERE `telephone`='987456123' ";
$result = $connection->fetchAll($sql);
$myCustomerId='';
foreach($result as $key => $value)
$myCustomerId = $value['entity_id'];
$customer->load($myCustomerId);
echo "<pre>";
$data= $customer->getData();
print_r($data);
echo 'Lastname=='.$data['lastname']."</br>";
echo 'DOB=='.$data['dob'];
?>
Screenshot: http://prntscr.com/fss6ql
add a comment |
Please use the below code in test.php and run the same in the root folder.
<?php
use MagentoFrameworkAppBootstrap;
include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$url = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $url->get('MagentoStoreModelStoreManagerInterface');
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$websiteId = $storeManager->getWebsite()->getWebsiteId();
// Get Store ID
$store = $storeManager->getStore();
$storeId = $store->getStoreId();
$customerFactory = $objectManager->get('MagentoCustomerModelCustomerFactory');
$customer=$customerFactory->create();
$customer->setWebsiteId($websiteId);
//$customer->loadByEmail('roni_cost@example.com');// load customer by email address
//echo $customer->getEntityId();
// $customer->load('1');// load customer by using ID
//$data= $customer->getData();
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // Instance of object manager
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_address_entity');
$sql = "SELECT entity_id FROM `customer_address_entity` WHERE `telephone`='987456123' ";
$result = $connection->fetchAll($sql);
$myCustomerId='';
foreach($result as $key => $value)
$myCustomerId = $value['entity_id'];
$customer->load($myCustomerId);
echo "<pre>";
$data= $customer->getData();
print_r($data);
echo 'Lastname=='.$data['lastname']."</br>";
echo 'DOB=='.$data['dob'];
?>
Screenshot: http://prntscr.com/fss6ql
Please use the below code in test.php and run the same in the root folder.
<?php
use MagentoFrameworkAppBootstrap;
include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$url = MagentoFrameworkAppObjectManager::getInstance();
$storeManager = $url->get('MagentoStoreModelStoreManagerInterface');
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$websiteId = $storeManager->getWebsite()->getWebsiteId();
// Get Store ID
$store = $storeManager->getStore();
$storeId = $store->getStoreId();
$customerFactory = $objectManager->get('MagentoCustomerModelCustomerFactory');
$customer=$customerFactory->create();
$customer->setWebsiteId($websiteId);
//$customer->loadByEmail('roni_cost@example.com');// load customer by email address
//echo $customer->getEntityId();
// $customer->load('1');// load customer by using ID
//$data= $customer->getData();
$objectManager = MagentoFrameworkAppObjectManager::getInstance(); // Instance of object manager
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_address_entity');
$sql = "SELECT entity_id FROM `customer_address_entity` WHERE `telephone`='987456123' ";
$result = $connection->fetchAll($sql);
$myCustomerId='';
foreach($result as $key => $value)
$myCustomerId = $value['entity_id'];
$customer->load($myCustomerId);
echo "<pre>";
$data= $customer->getData();
print_r($data);
echo 'Lastname=='.$data['lastname']."</br>";
echo 'DOB=='.$data['dob'];
?>
Screenshot: http://prntscr.com/fss6ql
edited Jul 7 '17 at 12:32
answered Jul 7 '17 at 12:25
Nagaraju KasaNagaraju Kasa
2,79821742
2,79821742
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f182595%2fhow-to-get-customer-data-by-telephone-number-in-magento2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Address Phone number ? or you created new customer attribute ?
– Pankaj Pareek
Jul 7 '17 at 11:04
Welcome to SE. Try to explain your issue in details also if you have tried any code put in here. It will be much easy to help you.
– Priyank
Jul 7 '17 at 11:11
It is default Billing Address -> Phone number.
– user3374995
Jul 7 '17 at 12:25
Please check the below code and get back with u r feedback thanks
– Nagaraju Kasa
Jul 7 '17 at 12:34
Please let me know whether it's working or not. thanks
– Nagaraju Kasa
Jul 7 '17 at 12:35