[-] BO : fixed bug #PSCFV-2827 - AdminProducts : Customer autocomplete on specific price not available
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16013 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -27,80 +27,81 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var product_url = '{$link->getAdminLink('AdminProducts', true)}';
|
var product_url = '{$link->getAdminLink('AdminProducts', true)}';
|
||||||
|
$(document).ready(function () {
|
||||||
var Customer = {
|
var Customer = {
|
||||||
"hiddenField": jQuery('#id_customer'),
|
"hiddenField": jQuery('#id_customer'),
|
||||||
"field": jQuery('#customer'),
|
"field": jQuery('#customer'),
|
||||||
"container": jQuery('#customers'),
|
"container": jQuery('#customers'),
|
||||||
"loader": jQuery('#customerLoader'),
|
"loader": jQuery('#customerLoader'),
|
||||||
"init": function() {
|
"init": function() {
|
||||||
jQuery(Customer.field).typeWatch({
|
jQuery(Customer.field).typeWatch({
|
||||||
"captureLength": 1,
|
"captureLength": 1,
|
||||||
"highlight": true,
|
"highlight": true,
|
||||||
"wait": 50,
|
"wait": 50,
|
||||||
"callback": Customer.search
|
"callback": Customer.search
|
||||||
}).focus(Customer.placeholderIn).blur(Customer.placeholderOut);
|
}).focus(Customer.placeholderIn).blur(Customer.placeholderOut);
|
||||||
},
|
},
|
||||||
"placeholderIn": function() {
|
"placeholderIn": function() {
|
||||||
if (this.value == '{l s='All customers'}') {
|
if (this.value == '{l s='All customers'}') {
|
||||||
this.value = '';
|
this.value = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"placeholderOut": function() {
|
"placeholderOut": function() {
|
||||||
if (this.value == '') {
|
if (this.value == '') {
|
||||||
this.value = '{l s='All customers'}';
|
this.value = '{l s='All customers'}';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"search": function()
|
"search": function()
|
||||||
{
|
{
|
||||||
Customer.showLoader();
|
Customer.showLoader();
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"url": "{$link->getAdminLink('AdminCustomers')}",
|
"url": "{$link->getAdminLink('AdminCustomers')}",
|
||||||
"async": true,
|
"async": true,
|
||||||
"dataType": "json",
|
"dataType": "json",
|
||||||
"data": {
|
"data": {
|
||||||
"ajax": "1",
|
"ajax": "1",
|
||||||
"token": "{getAdminToken tab='AdminCustomers'}",
|
"token": "{getAdminToken tab='AdminCustomers'}",
|
||||||
"tab": "AdminCustomers",
|
"tab": "AdminCustomers",
|
||||||
"action": "searchCustomers",
|
"action": "searchCustomers",
|
||||||
"customer_search": Customer.field.val()
|
"customer_search": Customer.field.val()
|
||||||
},
|
},
|
||||||
"success": Customer.success
|
"success": Customer.success
|
||||||
});
|
|
||||||
},
|
|
||||||
"success": function(result)
|
|
||||||
{
|
|
||||||
if(result.found) {
|
|
||||||
var html = '<ul class="clearfix">';
|
|
||||||
jQuery.each(result.customers, function() {
|
|
||||||
html += '<li><a class="fancybox" href="{$link->getAdminLink('AdminCustomers')}&id_customer='+this.id_customer+'&viewcustomer&liteDisplaying=1">'+this.firstname+' '+this.lastname+'</a>'+(this.birthday ? ' - '+this.birthday:'')+'<br/>';
|
|
||||||
html += '<a href="mailto:'+this.email+'">'+this.email+'</a><br />';
|
|
||||||
html += '<a onclick="Customer.select('+this.id_customer+', \''+this.firstname+' '+this.lastname+'\'); return false;" href="#" class="button">{l s='Choose'}</a></li>';
|
|
||||||
});
|
});
|
||||||
html += '</ul>';
|
},
|
||||||
|
"success": function(result)
|
||||||
|
{
|
||||||
|
if(result.found) {
|
||||||
|
var html = '<ul class="clearfix">';
|
||||||
|
jQuery.each(result.customers, function() {
|
||||||
|
html += '<li><a class="fancybox" href="{$link->getAdminLink('AdminCustomers')}&id_customer='+this.id_customer+'&viewcustomer&liteDisplaying=1">'+this.firstname+' '+this.lastname+'</a>'+(this.birthday ? ' - '+this.birthday:'')+'<br/>';
|
||||||
|
html += '<a href="mailto:'+this.email+'">'+this.email+'</a><br />';
|
||||||
|
html += '<a onclick="Customer.select('+this.id_customer+', \''+this.firstname+' '+this.lastname+'\'); return false;" href="#" class="button">{l s='Choose'}</a></li>';
|
||||||
|
});
|
||||||
|
html += '</ul>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
html = '<div class="warn">{l s='No customers found'}</div>';
|
||||||
|
Customer.hideLoader();
|
||||||
|
Customer.container.html(html);
|
||||||
|
jQuery('.fancybox', Customer.container).fancybox();
|
||||||
|
},
|
||||||
|
"select": function(id_customer, fullname)
|
||||||
|
{
|
||||||
|
Customer.hiddenField.val(id_customer);
|
||||||
|
Customer.field.val(fullname);
|
||||||
|
Customer.container.empty();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
"showLoader": function() {
|
||||||
|
Customer.loader.fadeIn();
|
||||||
|
},
|
||||||
|
"hideLoader": function() {
|
||||||
|
Customer.loader.fadeOut();
|
||||||
}
|
}
|
||||||
else
|
};
|
||||||
html = '<div class="warn">{l s='No customers found'}</div>';
|
Customer.init();
|
||||||
Customer.hideLoader();
|
});
|
||||||
Customer.container.html(html);
|
|
||||||
jQuery('.fancybox', Customer.container).fancybox();
|
|
||||||
},
|
|
||||||
"select": function(id_customer, fullname)
|
|
||||||
{
|
|
||||||
Customer.hiddenField.val(id_customer);
|
|
||||||
Customer.field.val(fullname);
|
|
||||||
Customer.container.empty();
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
"showLoader": function() {
|
|
||||||
Customer.loader.fadeIn();
|
|
||||||
},
|
|
||||||
"hideLoader": function() {
|
|
||||||
Customer.loader.fadeOut();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
jQuery(document).ready(Customer.init);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{* END CUSTOMER AUTO-COMPLETE / TO REFACTO *}
|
{* END CUSTOMER AUTO-COMPLETE / TO REFACTO *}
|
||||||
|
|||||||
Reference in New Issue
Block a user