*/ class CartCallbacks { /** */ function callback($params, &$smarty, $callback, $userId=null) { global $gallery; switch($callback) { case 'LoadCart': /* The cart contents' count */ GalleryCoreApi::requireOnce('modules/cart/classes/CartHelper.class'); list ($ret, $cartItemIds) = CartHelper::fetchCartItemCounts(); if ($ret) { return $ret->wrap(__FILE__, __LINE__); } $unique = array_keys($cartItemIds); $total = 0; foreach ($cartItemIds as $itemId => $count) { $total += $count; } $block =& $smarty->_tpl_vars['block']; $block['cart']['ShowCart']['unique'] = $unique; $block['cart']['ShowCart']['total'] = $total; return null; } return GalleryCoreApi::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__); } } ?>