// Multishipping : Refresh carrier list
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10502 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -109,7 +109,7 @@ function changeAddressDelivery(obj)
|
||||
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||
if (jsonData.carriers != null)
|
||||
updateCarrierList(jsonData);
|
||||
getCarrierListAndUpdate();
|
||||
|
||||
// @todo reverse the remove order
|
||||
// This effect remove the current line, but it's better to remove the other one, and refresshing this one
|
||||
@@ -299,7 +299,7 @@ function deleteProductFromSummary(id)
|
||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||
updateCustomizedDatas(jsonData.customizedDatas);
|
||||
if (jsonData.carriers != null)
|
||||
updateCarrierList(jsonData);
|
||||
getCarrierListAndUpdate();
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||
@@ -349,7 +349,7 @@ function upQuantity(id, qty)
|
||||
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||
if (jsonData.carriers != null)
|
||||
updateCarrierList(jsonData);
|
||||
getCarrierListAndUpdate();
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||
@@ -408,7 +408,7 @@ function downQuantity(id, qty)
|
||||
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||
if (jsonData.carriers != null)
|
||||
updateCarrierList(jsonData);
|
||||
getCarrierListAndUpdate();
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||
|
||||
@@ -26,79 +26,12 @@
|
||||
|
||||
function updateCarrierList(json)
|
||||
{
|
||||
var carriers = json.carriers;
|
||||
var html = json.carrier_block;
|
||||
|
||||
/* contains all carrier available for this address */
|
||||
if (!carriers || carriers.length == 0)
|
||||
{
|
||||
checkedCarrier = 0;
|
||||
$('input[name=id_carrier]:checked').attr('checked', false);
|
||||
$('#noCarrierWarning').show();
|
||||
$('#extra_carrier').hide();
|
||||
$('#recyclable_block').hide();
|
||||
$('table#carrierTable:visible').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkedCarrier = json.checked;
|
||||
var html = '';
|
||||
for (i=0;i<carriers.length; i++)
|
||||
{
|
||||
var itemType = '';
|
||||
|
||||
if (i == 0)
|
||||
itemType = 'first_item ';
|
||||
else if (i == carriers.length-1)
|
||||
itemType = 'last_item ';
|
||||
if (i % 2)
|
||||
itemType = itemType + 'alternate_item';
|
||||
else
|
||||
itemType = itemType + 'item';
|
||||
|
||||
var name = carriers[i].name;
|
||||
if (carriers[i].img != '')
|
||||
name = '<img src="'+carriers[i].img+'" alt="" />';
|
||||
|
||||
if (carriers[i].is_module > 0 && !isLogged)
|
||||
var extraHtml = 'disabled="disabled"';
|
||||
else if (checkedCarrier == carriers[i].id_carrier)
|
||||
var extraHtml = 'checked="checked"';
|
||||
else
|
||||
var extraHtml = '';
|
||||
|
||||
if (carriers[i].price == 0)
|
||||
var price = txtFree;
|
||||
else
|
||||
{
|
||||
if (taxEnabled && displayPrice == 0)
|
||||
var price = '<span class="price">'+formatCurrency(carriers[i].price, currencyFormat, currencySign, currencyBlank)+'</span>';
|
||||
else
|
||||
var price = '<span class="price">'+formatCurrency(carriers[i].price_tax_exc, currencyFormat, currencySign, currencyBlank)+'</span>';
|
||||
}
|
||||
|
||||
html = html +
|
||||
'<tr class="'+itemType+'">'+
|
||||
'<td class="carrier_action radio"><input type="radio" name="id_carrier" value="'+carriers[i].id_carrier+'" id="id_carrier'+carriers[i].id_carrier+'" onclick="updateCarrierSelectionAndGift();" '+extraHtml+' /></td>'+
|
||||
'<td class="carrier_name"><label for="id_carrier'+carriers[i].id_carrier+'">'+name+'</label></td>'+
|
||||
'<td class="carrier_infos">'+(carriers[i].delay != null ? carriers[i].delay : '')+'</td>'+
|
||||
'<td class="carrier_price">'+price;
|
||||
if (carriers[i].price != 0)
|
||||
{
|
||||
if (taxEnabled && displayPrice == 0)
|
||||
html = html + ' ' + txtWithTax;
|
||||
else
|
||||
html = html + ' ' + txtWithoutTax;
|
||||
}
|
||||
html = html + '</td>'+
|
||||
'</tr>';
|
||||
}
|
||||
if (json.HOOK_EXTRACARRIER !== null && json.HOOK_EXTRACARRIER != undefined) html += json.HOOK_EXTRACARRIER;
|
||||
$('#noCarrierWarning').hide();
|
||||
$('#extra_carrier:hidden').show();
|
||||
$('table#carrierTable tbody').html(html);
|
||||
$('table#carrierTable:hidden').show();
|
||||
$('#recyclable_block:hidden').show();
|
||||
}
|
||||
if (json.HOOK_EXTRACARRIER !== null && json.HOOK_EXTRACARRIER != undefined)
|
||||
html += json.HOOK_EXTRACARRIER;
|
||||
|
||||
$('#carrier_area').replaceWith(html);
|
||||
|
||||
/* update hooks for carrier module */
|
||||
$('#HOOK_BEFORECARRIER').html(json.HOOK_BEFORECARRIER);
|
||||
@@ -139,7 +72,7 @@ function updateAddressSelection()
|
||||
}
|
||||
else
|
||||
{
|
||||
updateCarrierList(jsonData);
|
||||
updateCarrierList(jsonData.carrier_data);
|
||||
updatePaymentMethods(jsonData);
|
||||
updateCartSummary(jsonData.summary);
|
||||
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
|
||||
@@ -193,13 +126,14 @@ function updateCarrierSelectionAndGift()
|
||||
var recyclablePackage = 0;
|
||||
var gift = 0;
|
||||
var giftMessage = '';
|
||||
var idCarrier = 0;
|
||||
|
||||
var delivery_option_radio = $('.delivery_option_radio');
|
||||
var delivery_option_params = '&';
|
||||
$.each(delivery_option_radio, function(i) {
|
||||
delivery_option_params += $(delivery_option_radio[i]).attr('name') + '=' + $(delivery_option_radio[i]).val() + '&';
|
||||
});
|
||||
if (delivery_option_params == '&')
|
||||
delivery_option_params = '&delivery_option=&'
|
||||
|
||||
if ($('input#recyclable:checked').length)
|
||||
recyclablePackage = 1;
|
||||
@@ -209,12 +143,6 @@ function updateCarrierSelectionAndGift()
|
||||
giftMessage = encodeURIComponent($('textarea#gift_message').val());
|
||||
}
|
||||
|
||||
if ($('input[name=id_carrier]:checked').length)
|
||||
{
|
||||
idCarrier = $('input[name=id_carrier]:checked').val();
|
||||
checkedCarrier = idCarrier;
|
||||
}
|
||||
|
||||
$('#opc_payment_methods-overlay').fadeIn('slow');
|
||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
||||
$.ajax({
|
||||
@@ -390,7 +318,7 @@ function updateNewAccountToAddressBlock()
|
||||
$('#opc_new_account').fadeIn('fast', function() {
|
||||
updateCartSummary(json.summary);
|
||||
updateAddressesDisplay(true);
|
||||
updateCarrierList(json.carrier_list);
|
||||
updateCarrierList(json.carrier_data);
|
||||
updatePaymentMethods(json);
|
||||
if ($('#gift-price').length == 1)
|
||||
$('#gift-price').html(json.gift_price);
|
||||
@@ -806,6 +734,6 @@ function multishippingMode(it)
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
if (multishipping_mode)
|
||||
if (typeof(multishipping_mode) != 'undefined' && multishipping_mode)
|
||||
$('#multishipping_mode').click();
|
||||
});
|
||||
@@ -23,7 +23,7 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div id="carrier_area">
|
||||
{if !$opc}
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
@@ -60,10 +60,10 @@
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
// <![CDATA[
|
||||
$('document').ready( function(){
|
||||
$('document').ready( function(){
|
||||
if ($('input#gift').is(':checked'))
|
||||
$('p#gift_div').show();
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
{/literal}
|
||||
</script>
|
||||
@@ -240,3 +240,4 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user