cancel
Showing results for 
Search instead for 
Did you mean: 

Open customer page from external page (same domain)

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Open customer page from external page (same domain)

Hello

 

I'm new to magento, and I'm developing a simple search page to query remotely from a PBX system, to search a customer by phone number. When a call enters in the PBX system, I have a chrome plugin that opens an URL like this:

 

https://www.server.com/busqueda.php?phone=666777888

 

And the code of "busqueda.php" is this:

 

<?php
require_once("app/Mage.php");
umask(0);
Mage::app("default");
$phone = $_GET['phone'];
$link = mysql_connect('127.0.0.1', 'xxxxxxxx', 'xxxxxxx');
mysql_select_db('xxxxxxx');
$sql = "select entity_id from customer_address_entity_varchar where (attribute_id=158 or attribute_id=31) and value='$phone' limit 1";
$result = mysql_query($sql);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $value = $line['entity_id'];
}
$sql = "SELECT entity_id FROM `customer_entity_int` WHERE value = '$value' limit 1";
$result = mysql_query($sql);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $customer_id = $line['entity_id'];
}
$url = Mage::helper('adminhtml')->getUrl('adminhtml/customer/edit', array('id' => $customer_id,"_nosid"=>true));
$url2 = str_replace("com//","com/index.php/admin/",$url);
header("Location: $url2");
?>

 

Code works fine, I generate a link like this:

 

https://www.server.com/admin/customer/edit/id/5352/key/7bb21e774ba73eab94d5118417c47f80/

 

But instead this particular customer data, it opens the list of all customers. I'm logged in another tab of the same browser

 

Why I can't open one customer data page?

 

Thank you!