[-] FO : #PSCFV-2158 - Add warning message when a product cannot be delivered to an address

This commit is contained in:
mDeflotte
2012-05-03 08:10:09 +00:00
parent f35a7fe4b2
commit e02e6238c8
9 changed files with 99 additions and 33 deletions
+30 -20
View File
@@ -99,28 +99,37 @@ function changeAddressDelivery(obj)
+'&allow_refresh=1',
success: function(jsonData)
{
// The product exist
if ($('#product_'+id_product+'_'+id_product_attribute+'_0_'+new_id_address_delivery).length)
if (typeof(jsonData.hasErrors) != 'undefined' && jsonData.hasErrors)
{
updateCustomizedDatas(jsonData.customizedDatas);
updateCartSummary(jsonData.summary);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (typeof(getCarrierListAndUpdate) != 'undefined')
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
$('#product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
// @todo improve customization upgrading
$('.product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
alert(jsonData.error);
// Reset the old address
$('#select_address_delivery_'+id_product+'_'+id_product_attribute+'_'+old_id_address_delivery).val(old_id_address_delivery);
}
else
{
// The product exist
if ($('#product_'+id_product+'_'+id_product_attribute+'_0_'+new_id_address_delivery).length)
{
updateCustomizedDatas(jsonData.customizedDatas);
updateCartSummary(jsonData.summary);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (typeof(getCarrierListAndUpdate) != 'undefined')
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
$('#product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
// @todo improve customization upgrading
$('.product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
}
if (window.ajaxCart !== undefined)
ajaxCart.refresh();
updateAddressId(id_product, id_product_attribute, old_id_address_delivery, new_id_address_delivery);
cleanSelectAddressDelivery();
}
if (window.ajaxCart !== undefined)
ajaxCart.refresh();
updateAddressId(id_product, id_product_attribute, old_id_address_delivery, new_id_address_delivery);
cleanSelectAddressDelivery();
}
});
}
@@ -192,6 +201,7 @@ function changeAddressDelivery(obj)
}
});
}
return true;
}
function updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, line)
+6 -5
View File
@@ -201,11 +201,12 @@
<div class="hook_extracarrier" id="HOOK_EXTRACARRIER_{$id_address}">{if isset($HOOK_EXTRACARRIER_ADDR)}{$HOOK_EXTRACARRIER_ADDR.$id_address}{/if}</div>
{foreachelse}
<p class="warning" id="noCarrierWarning">
{if $cart->isMultiAddressDelivery()}
{l s='There are no carriers available that deliver to some of your addresses.'}
{else}
{l s='There are no carriers available that deliver to this address.'}
{/if}
{foreach $cart->getDeliveryAddressesWithoutCarriers(true) as $address}
{l s='No carriers available for the address "%s".' sprintf=$address->alias}
{if !$address@last}
<br />
{/if}
{/foreach}
</p>
{/foreach}
{/if}