本文整理汇总了PHP中Cart66Common::tax方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::tax方法的具体用法?PHP Cart66Common::tax怎么用?PHP Cart66Common::tax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::tax方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$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();
示例2: ajaxTaxUpdate
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;
}
示例3: str_pad
<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>
示例4: isset
$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>
示例5: getTax
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;
}