$gateway->validateCartForCheckout(); $gateway->setBilling(Cart66Common::postVal('billing')); $gateway->setPayment(Cart66Common::postVal('payment')); // Note that mijireh does not have a "same as billing" checkbox if (isset($_POST['sameAsBilling'])) { $gateway->setShipping(Cart66Common::postVal('billing'), true); } elseif (isset($_POST['shipping'])) { $gateway->setShipping(Cart66Common::postVal('shipping')); } $s = $gateway->getShipping(); if ($s['state'] && $s['zip']) { $taxLocation = $gateway->getTaxLocation(); $tax = $gateway->getTaxAmount(); $rate = $gateway->getTaxRate(); Cart66Session::set('Cart66Tax', $tax); Cart66Session::set('Cart66TaxRate', Cart66Common::tax($rate)); Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Tax PreCalculated: \$" . $tax); } if (count($errors) == 0) { $errors = $gateway->getErrors(); // Error info for server side error code if (count($errors)) { try { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Unable to process order: " . print_r($errors, true)); throw new Cart66Exception(__('Your order could not be processed for the following reasons:', 'cart66'), 66500); } catch (Cart66Exception $e) { $exception = Cart66Exception::exceptionMessages($e->getCode(), $e->getMessage(), $errors); echo Cart66Common::getView('views/error-messages.php', $exception); } } $jqErrors = $gateway->getJqErrors();
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; }
<td> <?php if ($rate->zip_low > 0) { if ($rate->zip_low > 0) { echo str_pad($rate->zip_low, 5, "0", STR_PAD_LEFT); } if ($rate->zip_high > $rate->zip_low) { echo '-' . str_pad($rate->zip_high, 5, "0", STR_PAD_LEFT); } } else { echo $rate->getFullStateName(); } ?> </td> <td><?php echo Cart66Common::tax($rate->rate); ?> </td> <td> <?php echo $rate->tax_shipping > 0 ? __("yes", "cart66") : __("no", "cart66"); ?> </td> <td> <a class="delete" href="?page=cart66-settings&task=deleteTax&tab=tax_settings&id=<?php echo $rate->id; ?> "><?php _e('Delete', 'cart66'); ?> </a>
$promotionDiscountAmount = Cart66Session::get('Cart66Cart')->getDiscountAmount(); echo Cart66Common::currency($promotionDiscountAmount); ?> </td> </tr> <?php } ?> <tr class="tax-row <?php echo $tax > 0 ? 'show-tax-row' : 'hide-tax-row'; ?> "> <td colspan="2"> </td> <?php $taxRate = isset($data['rate']) ? Cart66Common::tax($data['rate']) : Cart66Session::get('Cart66TaxRate'); ?> <td class="alignRight strong"><span class="ajax-spin"><img src="<?php echo CART66_URL; ?> /images/ajax-spin.gif" /></span> <?php _e('Tax', 'cart66'); ?> (<span class="tax-rate"><?php echo $taxRate; ?> </span>):</td> <td class="strong tax-amount cart66-align-right"><?php echo Cart66Common::currency($tax); ?> </td>
public function getTax($state = 'All Sales', $zip = null) { $tax = 0; $taxRate = new Cart66TaxRate(); $isTaxed = $taxRate->loadByZip($zip); if ($isTaxed == false) { $isTaxed = $taxRate->loadByState($state); if ($state == 'All Sales' && $isTaxed) { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] so i guess it's all sales? rate: " . $taxRate->rate); Cart66Session::set('Cart66TaxRate', Cart66Common::tax($taxRate->rate)); } } if ($isTaxed) { $taxable = $this->getTaxableAmount($taxRate->tax_shipping); $tax = number_format($taxable * ($taxRate->rate / 100), 2, '.', ''); } return $tax; }