12792 - fix ajax update delivery dates
This commit is contained in:
parent
e15acce73b
commit
2e69dd1b8d
@ -52,6 +52,7 @@ class CartController extends CartControllerCore
|
||||
|
||||
Cart::addExtraCarriers($result);
|
||||
}
|
||||
|
||||
$result['summary'] = $this->context->cart->getSummaryDetails(null, true);
|
||||
$result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);
|
||||
$result['HOOK_SHOPPING_CART'] = Hook::exec('displayShoppingCartFooter', $result['summary']);
|
||||
@ -107,6 +108,15 @@ class CartController extends CartControllerCore
|
||||
$result['summary']['notEligible'] = $notEligible;
|
||||
$result['summary']['free_shipping_ok'] = $free_shipping_ok;
|
||||
|
||||
$delivery_dates = SaleCore::getDeliveryRangeDates($this->context->cart);
|
||||
if (is_array($delivery_dates)) {
|
||||
$result['delivery_date_start'] = strftime('%A %d/%m', $delivery_dates['start']->getTimestamp());
|
||||
$result['delivery_date_end'] = strftime('%A %d/%m', $delivery_dates['end']->getTimestamp());
|
||||
}
|
||||
elseif ($delivery_dates === SaleCore::DATE_RANGE_OTHER_DELAY) {
|
||||
$result['delivery_other_delay_title'] = $this->context->cart->checkProductOtherDeliveryDelai(true);
|
||||
}
|
||||
|
||||
foreach ($result['summary']['products'] as $key => &$product)
|
||||
{
|
||||
$product['quantity_without_customization'] = $product['quantity'];
|
||||
|
@ -488,6 +488,7 @@ function deleteProductFromSummary(id)
|
||||
refreshOddRow();
|
||||
});
|
||||
}
|
||||
updateCartDeliveryDates(jsonData);
|
||||
updateCartSummary(jsonData.summary);
|
||||
if (window.ajaxCart != undefined)
|
||||
ajaxCart.updateCart(jsonData);
|
||||
@ -722,6 +723,7 @@ function downQuantity(id, qty)
|
||||
{
|
||||
if (jsonData.refresh)
|
||||
location.reload();
|
||||
updateCartDeliveryDates(jsonData);
|
||||
updateCartSummary(jsonData.summary);
|
||||
if (window.ajaxCart !== undefined)
|
||||
ajaxCart.updateCart(jsonData);
|
||||
@ -833,7 +835,7 @@ function updateCartSummary(json)
|
||||
saving_price = parseFloat(saving_price) + ( (parseFloat(product_list[i].price_without_quantity_discount)-parseFloat(product_list[i].price_wt) ) * parseInt(product_list[i].quantity));
|
||||
|
||||
}
|
||||
console.log('change');
|
||||
|
||||
if (json.remaining_for_free_shipping) {
|
||||
if($('#cart_free_shipping_info span.cart_free_shipping_price_remaining').length<1)
|
||||
$('#cart_free_shipping_info').html("Il ne vous reste plus que <span class='cart_free_shipping_price_remaining'></span>TTC d'achat pour bénéficier de la livraison gratuite");
|
||||
@ -1066,4 +1068,15 @@ function updateExtraCarrier(id_delivery_option, id_address)
|
||||
$('#HOOK_EXTRACARRIER_' + id_address).html(jsonData['content']);
|
||||
}
|
||||
});
|
||||
}
|
||||
function updateCartDeliveryDates(jsonData)
|
||||
{
|
||||
if (jsonData.delivery_date_start) {
|
||||
$('.cart_free_shipping_delivery').html("Livraison prévue<br />entre le <span class=\"cart_delivery_dates\">"+jsonData.delivery_date_start+"</span> et le <span class=\"cart_delivery_dates\">"+jsonData.delivery_date_end+"</span>");
|
||||
$('.cart_free_shipping_delivery').show('slow');
|
||||
}
|
||||
else if (jsonData.delivery_other_delay_title) {
|
||||
$('.cart_free_shipping_delivery').html("Nous mettons tout en oeuvre pour expédier vos produits sous "+jsonData.delivery_other_delay_title);
|
||||
$('.cart_free_shipping_delivery').show('slow');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user