diff --git a/uc_ajax_cart.module b/uc_ajax_cart.module index e1b3af6..565b41f 100644 --- a/uc_ajax_cart.module +++ b/uc_ajax_cart.module @@ -89,17 +89,6 @@ function uc_ajax_cart_menu() { function uc_ajax_cart_callback($op, $nid = NULL, $data = NULL) { - $cacheEnabled = variable_get('cache', 0); - if ($cacheEnabled > 0 && !$user->uid) { - $page = request_uri(); - global $base_root; - cache_clear_all($base_root . 'uc_ajax_cart/show', 'cache_page'); - cache_clear_all($base_root . 'uc_ajax_cart/remove', 'cache_page'); - cache_clear_all($base_root . 'uc_ajax_cart/show-cart-view', 'cache_page'); - cache_clear_all($base_root . 'uc_ajax_cart/update', 'cache_page'); - cache_clear_all($base_root . 'uc_ajax_cart/link', 'cache_page'); - } - switch ($op) { case 'remove': uc_ajax_cart_remove_item($_GET['nid'], unserialize(base64_decode($_GET['data']))); @@ -407,3 +396,22 @@ function uc_ajax_cart_theme_registry_alter(&$theme_registry) { function uc_ajax_uc_empty_cart() { return '

'. t('There are no products in your shopping cart.') .'

'; } + + +/** +* Implements hook_exit(). +* +* Code from CacheExclude - http://drupal.org/project/cacheexclude +*/ +function uc_cart_exit() { + global $base_root; + + $pages = array('uc_ajax_cart', UC_AJAX_CART_ADD_CALLBACK, UC_AJAX_CART_REMOVE_CALLBACK, UC_AJAX_CART_SHOW_CALLBACK, UC_AJAX_CART_LINK_CALLBACK, UC_AJAX_CART_UPDATE_CALLBACK, UC_AJAX_CART_SHOW_VIEW_CALLBACK); + $this_page = request_uri(); + foreach ($pages as $page) { + if ($page && strstr($this_page, $page) !== FALSE) { + cache_clear_all($base_root . $this_page, 'cache_page'); + return; + } + } +}