public static function ajaxTaxUpdate() { if (isset($_POST['state']) && isset($_POST['state_text']) && isset($_POST['zip']) && isset($_POST['gateway'])) { $gateway = Cart66Ajax::loadAjaxGateway($_POST['gateway']); $gateway->setShipping(array('state_text' => $_POST['state_text'], 'state' => $_POST['state'], 'zip' => $_POST['zip'])); $s = $gateway->getShipping(); if ($s['state'] && $s['zip']) { $id = 1; $taxLocation = $gateway->getTaxLocation(); $tax = $gateway->getTaxAmount(); $rate = $gateway->getTaxRate(); $total = Cart66Session::get('Cart66Cart')->getGrandTotal() + $tax; Cart66Session::set('Cart66Tax', $tax); Cart66Session::set('Cart66TaxRate', Cart66Common::tax($rate)); } else { $id = 0; $tax = 0; $rate = 0; $total = Cart66Session::get('Cart66Cart')->getGrandTotal() + $tax; Cart66Session::set('Cart66Tax', $tax); Cart66Session::set('Cart66TaxRate', Cart66Common::tax($rate)); } if (Cart66Session::get('Cart66Cart')->getTax('All Sales')) { $rate = $gateway->getTaxRate(); Cart66Session::set('Cart66TaxRate', Cart66Common::tax($rate)); } } $result = array('id' => $id, 'state' => $s['state'], 'zip' => $s['zip'], 'tax' => Cart66Common::currency($tax), 'rate' => $rate == 0 ? '0.00%' : Cart66Common::tax($rate), 'total' => Cart66Common::currency($total)); echo json_encode($result); die; }
/** * Handles the query var trigger for the dyamic JS dialog */ public function ajaxTriggerCheck() { if (intval(get_query_var('cart66AjaxCartRequests')) == 1) { //Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] CHECKED INVENTORY"); Cart66Ajax::checkInventoryOnAddToCart(); exit; } if (intval(get_query_var('cart66AjaxCartRequests')) == 2) { //Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] AJAX ADD TO CART"); Cart66Ajax::ajaxAddToCart(); exit; } if (intval(get_query_var('cart66AjaxCartRequests')) == 3) { //Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] UPDATE CART WIDGETS WITH AJAX"); Cart66Ajax::ajaxCartElements(); exit; } if (intval(get_query_var('cart66AjaxCartRequests')) == 4) { //Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] CONFIRM ORDER VERIFICATION"); Cart66Ajax::ajaxTaxUpdate(); exit; } if (intval(get_query_var('cart66AjaxCartRequests')) == 5) { //Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] CONFIRM ORDER VERIFICATION"); Cart66Ajax::ajaxOrderLookUp(); exit; } }