[-] MO : Update cart function was not functionning + optis
This commit is contained in:
1 parent
5598d38f38
commit
f66a450e97
5 files changed
+123
-219
No files matched your search
@@ -23,19 +23,42 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
var ajaxQueries = new Array();
|
||||
|
||||
function resetAjaxQueries()
|
||||
function PS_SE_HandleEvent()
|
||||
{
|
||||
for (i = 0; i < ajaxQueries.length; ++i)
|
||||
ajaxQueries[i].abort();
|
||||
$(document).ready(function() {
|
||||
|
||||
ajaxQueries = new Array();
|
||||
$('#id_country').change(function() {
|
||||
resetAjaxQueries();
|
||||
updateStateByIdCountry();
|
||||
});
|
||||
if (SE_RefreshMethod == 0)
|
||||
{
|
||||
$('#id_state').change(function() {
|
||||
resetAjaxQueries();
|
||||
updateCarriersList();
|
||||
});
|
||||
$('#zipcode').bind('blur keyup',function(e) {
|
||||
if (e.type == 'blur' || e.keyCode == '13')
|
||||
{
|
||||
resetAjaxQueries();
|
||||
updateCarriersList();
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#update_carriers_list').click(function() {
|
||||
updateCarriersList();
|
||||
});
|
||||
$('#carriercompare_submit').click(function() {
|
||||
resetAjaxQueries();
|
||||
saveSelection();
|
||||
return false;
|
||||
});
|
||||
updateStateByIdCountry();
|
||||
});
|
||||
}
|
||||
|
||||
function displayWaitingAjax(type, message)
|
||||
{
|
||||
|
||||
$('#SE_AjaxDisplay').find('p').html(message);
|
||||
$('#SE_AjaxDisplay').css('display', type);
|
||||
}
|
||||
@@ -72,63 +95,67 @@ function updateStateByIdCountry()
|
||||
|
||||
function updateCarriersList()
|
||||
{
|
||||
$('#carriers_list').children().remove();
|
||||
$('#availableCarriers').slideUp('fast');
|
||||
$('#noCarrier').slideUp('fast');
|
||||
displayWaitingAjax('block', SE_RetrievingInfoTS);
|
||||
|
||||
var query = $.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(),
|
||||
data: 'method=getCarriers&id_country=' + $('#id_country').val() + '&id_state=' + $('#id_state').val() + '&zipcode=' + $('#zipcode').val(),
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
if (json.length)
|
||||
{
|
||||
for (carrier in json)
|
||||
$('#carriercompare_errors_list').children().remove();
|
||||
$('#availableCarriers').slideUp('normal', function(){
|
||||
$(this).find(('tbody')).children().remove();
|
||||
$('#noCarrier').slideUp('fast');
|
||||
displayWaitingAjax('block', SE_RetrievingInfoTS);
|
||||
|
||||
var query = $.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(),
|
||||
data: 'method=getCarriers&id_country=' + $('#id_country').val() + '&id_state=' + $('#id_state').val() + '&zipcode=' + $('#zipcode').val(),
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
if (json.length)
|
||||
{
|
||||
var html = '<tr class="'+(carrier % 2 ? 'alternate_' : '')+'item">'+
|
||||
'<td class="carrier_action radio">'+
|
||||
'<input type="radio" name="id_carrier" value="'+json[carrier].id_carrier+'" id="id_carrier'+json[carrier].id_carrier+'" '+(id_carrier == json[carrier].id_carrier ? 'checked="checked"' : '')+'/>'+
|
||||
for (carrier in json)
|
||||
{
|
||||
var html = '<tr class="'+(carrier % 2 ? 'alternate_' : '')+'item">'+
|
||||
'<td class="carrier_action radio">'+
|
||||
'<input type="radio" name="id_carrier" value="'+json[carrier].id_carrier+'" id="id_carrier'+json[carrier].id_carrier+'" '+(id_carrier == json[carrier].id_carrier ? 'checked="checked"' : '')+'/>'+
|
||||
'</td>'+
|
||||
'<td class="carrier_name">'+
|
||||
'<label for="id_carrier'+json[carrier].id_carrier+'">'+
|
||||
(json[carrier].img ? '<img src="'+json[carrier].img+'" alt="'+json[carrier].name+'" />' : json[carrier].name)+
|
||||
'</label>'+
|
||||
'</td>'+
|
||||
'<td class="carrier_name">'+
|
||||
'<label for="id_carrier'+json[carrier].id_carrier+'">'+
|
||||
(json[carrier].img ? '<img src="'+json[carrier].img+'" alt="'+json[carrier].name+'" />' : json[carrier].name)+
|
||||
'</label>'+
|
||||
'</td>'+
|
||||
'<td class="carrier_infos">'+((json[carrier].delay != null) ? json[carrier].delay : '') +'</td>'+
|
||||
'<td class="carrier_price">';
|
||||
|
||||
if (json[carrier].price)
|
||||
{
|
||||
html += '<span class="price">'+(displayPrice == 1 ? formatCurrency(json[carrier].price_tax_exc, currencyFormat, currencySign, currencyBlank) : formatCurrency(json[carrier].price, currencyFormat, currencySign, currencyBlank))+'</span>';
|
||||
'<td class="carrier_infos">'+((json[carrier].delay != null) ? json[carrier].delay : '') +'</td>'+
|
||||
'<td class="carrier_price">';
|
||||
|
||||
if (json[carrier].price)
|
||||
{
|
||||
html += '<span class="price">'+(displayPrice == 1 ? formatCurrency(json[carrier].price_tax_exc, currencyFormat, currencySign, currencyBlank) : formatCurrency(json[carrier].price, currencyFormat, currencySign, currencyBlank))+'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
html += txtFree;
|
||||
}
|
||||
html += '</td>'+
|
||||
'</tr>';
|
||||
$('#carriers_list').append(html);
|
||||
}
|
||||
else
|
||||
{
|
||||
html += txtFree;
|
||||
}
|
||||
html += '</td>'+
|
||||
'</tr>';
|
||||
$('#carriers_list').append(html);
|
||||
displayWaitingAjax('none', '');
|
||||
$('#availableCarriers').slideDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
displayWaitingAjax('none', '');
|
||||
$('#noCarrier').slideDown();
|
||||
}
|
||||
$('#availableCarriers').slideDown('fast');
|
||||
}
|
||||
else
|
||||
$('#noCarrier').slideDown('fast');
|
||||
displayWaitingAjax('none', '');
|
||||
}
|
||||
});
|
||||
ajaxQueries.push(query);
|
||||
});
|
||||
ajaxQueries.push(query);
|
||||
}
|
||||
|
||||
|
||||
function saveSelection()
|
||||
{
|
||||
$('#carriercompare_errors').slideUp();
|
||||
$('#carriercompare_errors_list').children().remove();
|
||||
$('#carriercompare_errors').slideUp('fast');
|
||||
displayWaitingAjax('block', SE_RedirectTS);
|
||||
$('#carriercompare_submit').attr('disabled', true);
|
||||
|
||||
|
||||
var query = $.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
@@ -140,9 +167,8 @@ function saveSelection()
|
||||
{
|
||||
for (error in json)
|
||||
$('#carriercompare_errors_list').append('<li>'+json[error]+'</li>');
|
||||
$('#carriercompare_errors').slideDown('fast');
|
||||
$('#carriercompare_errors').slideDown();
|
||||
displayWaitingAjax('none', '');
|
||||
$('#carriercompare_submit').removeAttr('disabled');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -155,35 +181,10 @@ function saveSelection()
|
||||
return false;
|
||||
}
|
||||
|
||||
function PS_SE_HandleEvent()
|
||||
var ajaxQueries = new Array();
|
||||
function resetAjaxQueries()
|
||||
{
|
||||
$(document).ready(function() {
|
||||
$('#id_country').change(function() {
|
||||
resetAjaxQueries();
|
||||
updateStateByIdCountry();
|
||||
});
|
||||
|
||||
if (SE_RefreshMethod == 0)
|
||||
{
|
||||
$('#id_state,#zipcode').change(function() {
|
||||
resetAjaxQueries();
|
||||
updateCarriersList();
|
||||
});
|
||||
$('#zipcode').keyup(function() {
|
||||
resetAjaxQueries();
|
||||
updateCarriersList();
|
||||
});
|
||||
}
|
||||
|
||||
$('#update_carriers_list').click(function() {
|
||||
updateCarriersList();
|
||||
});
|
||||
|
||||
$('#carriercompare_submit').click(function() {
|
||||
resetAjaxQueries();
|
||||
saveSelection();
|
||||
return false;
|
||||
});
|
||||
updateStateByIdCountry();
|
||||
});
|
||||
}
|
||||
for (i = 0; i < ajaxQueries.length; ++i)
|
||||
ajaxQueries[i].abort();
|
||||
ajaxQueries = new Array();
|
||||
}
|
||||
Reference in new issue
Block a user