From 7d5830af9407867520e258917cc83c188018d659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 20 May 2013 17:30:04 +0200 Subject: [PATCH] // add hack for blockcart cache and back button --- modules/blockcart/ajax-cart.js | 3 ++- modules/blockcart/blockcart.tpl | 1 + themes/default/modules/blockcart/blockcart.tpl | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index fef10cab0..872c448d9 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -670,8 +670,9 @@ $(document).ready(function(){ ajaxCart.overrideButtonsInThePage(); var cart_qty = 0; + var current_timestamp = parseInt(new Date().getTime() / 1000); - if (typeof $('.ajax_cart_quantity').html() == 'undefined') + if (typeof $('.ajax_cart_quantity').html() == 'undefined' || (generated_date != null && (parseInt(generated_date) + 30) < current_timestamp)) ajaxCart.refresh(); else cart_qty = parseInt($('.ajax_cart_quantity').html()); diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl index d33a601c3..0108a2381 100644 --- a/modules/blockcart/blockcart.tpl +++ b/modules/blockcart/blockcart.tpl @@ -38,6 +38,7 @@ var removingLinkText = '{l s='Please remove this product from my cart.' mod='blo var freeShippingTranslation = '{l s='Free shipping!' mod='blockcart' js=1}'; var freeProductTranslation = '{l s='Free!' mod='blockcart' js=1}'; var delete_txt = '{l s='Delete' mod='blockcart' js=1}'; +var generated_date = {$smarty.now|intval}; diff --git a/themes/default/modules/blockcart/blockcart.tpl b/themes/default/modules/blockcart/blockcart.tpl index d273fb881..e221858d4 100644 --- a/themes/default/modules/blockcart/blockcart.tpl +++ b/themes/default/modules/blockcart/blockcart.tpl @@ -38,6 +38,7 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart' var freeShippingTranslation = '{l s='Free shipping!' mod='blockcart' js=1}'; var freeProductTranslation = '{l s='Free!' mod='blockcart' js=1}'; var delete_txt = '{l s='Delete' mod='blockcart' js=1}'; +var generated_date = {$smarty.now|intval};