Revert the changes made to the ajaxprocess in the admin address controller
This commit is contained in:
@@ -60,22 +60,24 @@
|
||||
var email = $(this).find('[value="'+id_customer+'"]').text();
|
||||
$('#email').val(email);
|
||||
var data = {};
|
||||
data.id_customer = id_customer;
|
||||
data.email = email;
|
||||
data.token = "{$token|escape:'html':'UTF-8'}";
|
||||
data.ajax = 1;
|
||||
data.controller = "AdminAddresses";
|
||||
data.action = "loadCustomer";
|
||||
data.action = "loadNames";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax-tab.php",
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
async : true,
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
$('input[name=firstname]').val(response.firstname);
|
||||
$('input[name=lastname]').val(response.lastname);
|
||||
$('input[name=company]').val(response.company);
|
||||
success: function(msg) {
|
||||
if (msg) {
|
||||
var infos = msg.infos.replace("\\'", "'").split('_');
|
||||
$('input[name=firstname]').val(infos[0]);
|
||||
$('input[name=lastname]').val(infos[1]);
|
||||
$('input[name=company]').val(infos[2]);
|
||||
$('input[name=id_customer]').val(infos[3]);
|
||||
} else {
|
||||
resetCustomerRelatedAddressFields();
|
||||
}
|
||||
|
||||
@@ -527,22 +527,20 @@ class AdminAddressesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called when an ajax request is made to load the customer info for the selected email
|
||||
* Method called when an ajax request is made
|
||||
* @see AdminController::postProcess()
|
||||
*/
|
||||
public function ajaxProcessLoadCustomer()
|
||||
public function ajaxProcess()
|
||||
{
|
||||
$response = array('status' => false);
|
||||
if (Tools::getValue('id_customer')
|
||||
&& Validate::isLoadedObject($objCustomer = new Customer(Tools::getValue('id_customer')))
|
||||
) {
|
||||
$response['status'] = true;
|
||||
$response['firstname'] = $objCustomer->firstname;
|
||||
$response['lastname'] = $objCustomer->lastname;
|
||||
$response['company'] = $objCustomer->company;
|
||||
if (Tools::isSubmit('email')) {
|
||||
$email = pSQL(Tools::getValue('email'));
|
||||
$customer = Customer::searchByName($email);
|
||||
if (!empty($customer)) {
|
||||
$customer = $customer['0'];
|
||||
echo json_encode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company']).'_'.pSQL($customer['id_customer'])));
|
||||
}
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user