function uc_ajax_cart_callback in Ubercart AJAX Cart 6.2
Same name and namespace in other branches
- 7.2 uc_ajax_cart.module \uc_ajax_cart_callback()
1 string reference to 'uc_ajax_cart_callback'
File
- ./
uc_ajax_cart.module, line 71
Code
function uc_ajax_cart_callback($op, $nid = NULL, $data = NULL) {
// No caching for this URL.
global $conf;
$conf['cache'] = FALSE;
header('Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0');
header('Pragma: no-cache');
switch ($op) {
case 'remove':
uc_ajax_cart_remove_item($_GET['nid'], unserialize(base64_decode($_GET['data'])));
print theme('status_messages');
break;
case 'add':
uc_ajax_cart_add_item($_POST);
print theme('status_messages');
break;
case 'show':
uc_ajax_cart_show_cart();
break;
case 'show-cart-view':
include_once drupal_get_path('module', 'uc_cart') . '/uc_cart.pages.inc';
print uc_cart_view();
break;
case 'update':
if ($_POST) {
$formValues = array(
'values' => $_POST,
);
$cart = new UcAjaxCart();
$items = $cart
->getCartContents();
drupal_execute('uc_cart_view_form', $formValues, $items);
print theme('status_messages');
}
break;
case 'link':
if (module_exists('uc_cart_links')) {
$link = array_pop(explode('/', $_GET['href']));
uc_ajax_cart_links_process($link);
}
else {
drupal_set_message(t('Sorry link is not valid'), 'error');
}
print theme('status_messages');
break;
}
}