本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getTaxAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getTaxAmount方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getTaxAmount怎么用?PHP Mage_Sales_Model_Quote_Address::getTaxAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getTaxAmount方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$address->setPaymentCharge(0);
$address->setBasePaymentCharge(0);
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$paymentMethod = $address->getQuote()->getPayment()->getMethod();
if (Mage::getStoreConfig('tax/calculation/price_includes_tax') != 1) {
$tax = $address->getTaxAmount();
}
if ($paymentMethod) {
$amount1 = Mage::helper('paymentcharge')->getPaymentCharge($paymentMethod, $address->getQuote());
$amount = Mage::helper('directory')->currencyConvert($amount1, Mage::app()->getWebsite()->getConfig('currency/options/default'), Mage::app()->getStore()->getCurrentCurrencyCode());
// if(Mage::getStoreConfig('payment/paypal_payment_solutions/charge_type')!="percentage"){
$address->setPaymentCharge($amount);
$address->setBasePaymentCharge($amount1);
/* } else {
$address->setPaymentCharge($amount);
$subTotal = $address->getBaseSubtotal();
$amount12 = ($subTotal+ $tax) * floatval(Mage::getStoreConfig('payment/paypal_payment_solutions/charge_value')) / 100;
$address->setBasePaymentCharge($amount12);
}*/
}
$address->setGrandTotal($address->getGrandTotal() + $tax + $address->getPaymentCharge());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
return $this;
}
示例2: collect
/**
* Collect the order total
*
* @param object $address The address instance to collect from
*
* @return Sisow_Model_Quote_TaxTotal
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
if ($quote->getId() == null || $address->getAddressType() != "shipping") {
return $this;
}
$payment = $quote->getPayment();
if (substr($payment->getMethod(), 0, 6) != 'sisow_' && (!count($quote->getPaymentsCollection()) || !$payment->hasMethodInstance())) {
return $this;
}
$methodInstance = $payment->getMethodInstance();
if (substr($methodInstance->getCode(), 0, 6) != 'sisow_') {
return $this;
}
$helper = Mage::helper('sisow/paymentfee');
$fee = $helper->getPaymentFeeArray($methodInstance->getCode(), $quote);
if (!is_array($fee)) {
return $this;
}
$address->setTaxAmount($address->getTaxAmount() + $fee['taxamount']);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $fee['base_taxamount']);
$address->setInvoiceTaxAmount($fee['taxamount']);
$address->setBaseInvoiceTaxAmount($fee['base_taxamount']);
return $this;
}
示例3: fetchTotals
public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
{
$amount = $address->getTaxAmount();
if ($amount != 0) {
$address->addTotal(array('code' => 'tax', 'title' => Mage::helper('sales')->__('Tax'), 'value' => $amount));
}
return $this;
}
示例4: addressToOrder
/**
* Convert quote address model to order
*
* @param Mage_Sales_Model_Quote $quote
* @return Mage_Sales_Model_Order
*/
public function addressToOrder(Mage_Sales_Model_Quote_Address $address, $order = null)
{
if (!$order instanceof Mage_Sales_Model_Order) {
$order = $this->toOrder($address->getQuote());
}
$order->setWeight($address->getWeight())->setShippingMethod($address->getShippingMethod())->setShippingDescription($address->getShippingDescription())->setShippingRate($address->getShippingRate())->setSubtotal($address->getSubtotal())->setTaxAmount($address->getTaxAmount())->setDiscountAmount($address->getDiscountAmount())->setShippingAmount($address->getShippingAmount())->setGiftcertAmount($address->getGiftcertAmount())->setCustbalanceAmount($address->getCustbalanceAmount())->setGrandTotal($address->getGrandTotal())->setBaseSubtotal($address->getBaseSubtotal())->setBaseTaxAmount($address->getBaseTaxAmount())->setBaseDiscountAmount($address->getBaseDiscountAmount())->setBaseShippingAmount($address->getBaseShippingAmount())->setBaseGiftcertAmount($address->getBaseGiftcertAmount())->setBaseCustbalanceAmount($address->getBaseCustbalanceAmount())->setBaseGrandTotal($address->getBaseGrandTotal());
Mage::dispatchEvent('sales_convert_quote_address_to_order', array('address' => $address, 'order' => $order));
return $order;
}
示例5: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$address->setPaymentCharge(0);
$address->setBasePaymentCharge(0);
$storeId = Mage::app()->getStore()->getId();
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$paymentMethod = $address->getQuote()->getPayment()->getMethod();
$quote = $address->getQuote();
if ($paymentMethod && substr($paymentMethod, 0, 11) == 'pay_payment') {
$baseAmount = Mage::helper('pay_payment')->getPaymentCharge($paymentMethod, $address->getQuote());
$amount = Mage::helper('directory')->currencyConvert($baseAmount, Mage::app()->getWebsite()->getConfig('currency/options/default'), Mage::app()->getStore()->getCurrentCurrencyCode());
$address->setPaymentCharge($amount);
$address->setBasePaymentCharge($baseAmount);
$taxClass = Mage::helper('pay_payment')->getPaymentChargeTaxClass($paymentMethod);
$taxCalculationModel = Mage::getSingleton('tax/calculation');
$request = $taxCalculationModel->getRateRequest($quote->getShippingAddress(), $quote->getBillingAddress(), null, $storeId);
$request->setStore(Mage::app()->getStore());
$rate = $taxCalculationModel->getRate($request->setProductClassId($taxClass));
//$rate = 21;
if ($rate > 0) {
// $includesTax = Mage::getStoreConfig('tax/calculation/price_includes_tax');
$baseChargeTax = round($address->getBasePaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
$chargeTax = round($address->getPaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
} else {
$baseChargeTax = 0;
$chargeTax = 0;
}
$rates = array();
$applied = false;
foreach ($address->getAppliedTaxes() as $arrRate) {
// maximaal 1 keer de btw voor de extra kosten toevoegen
if ($arrRate['percent'] == $rate && !$applied) {
$applied = true;
$arrRate['amount'] = $arrRate['amount'] + $chargeTax;
$arrRate['base_amount'] = $arrRate['base_amount'] + $baseChargeTax;
}
$rates[] = $arrRate;
}
$address->setAppliedTaxes($rates);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseChargeTax);
$address->setTaxAmount($address->getTaxAmount() + $chargeTax);
$address->setGrandTotal($address->getGrandTotal() + $address->getPaymentCharge());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
}
return $this;
}
示例6: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$store = $address->getQuote()->getStore();
$taxConfig = Mage::getSingleton('tax/config');
$salesHelper = Mage::helper('sales');
if ($taxConfig->displayCartSubtotalBoth($store) || $taxConfig->displayCartSubtotalInclTax($store)) {
if ($address->getSubtotalInclTax() > 0) {
$subtotalInclTax = $address->getSubtotalInclTax();
} else {
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount() - $address->getPaymentFeeTax();
}
$address->addTotal(array('code' => 'subtotal', 'title' => $salesHelper->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}
示例7: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
if (!Mage::getSingleton('checkout/session')->getQuoteId()) {
return $this;
}
$_helper = Mage::helper('msp_cashondelivery');
$_model = Mage::getModel('msp_cashondelivery/cashondelivery');
$_subtotal = $address->getSubtotal();
$quote = $address->getQuote();
$baseAmount = $_model->getBaseExtraFee($_subtotal);
$amount = $_model->getExtraFee($_subtotal);
$codTax = $_helper->getTaxAmount($amount);
$codBaseTax = $_helper->getTaxAmount($baseAmount);
if ($quote->getPayment()->getMethod() == $_model->getCode() && $address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING) {
$address->setTaxAmount($address->getTaxAmount() + $codTax);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $codBaseTax);
$this->_saveAppliedTaxes($address, $_helper->getAppliedRates(), $codTax, $codBaseTax, $_helper->getRate());
$address->setGrandTotal($address->getGrandTotal() + $codTax);
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $codBaseTax);
}
return $this;
}
示例8: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$store = $address->getQuote()->getStore();
$session = Mage::getSingleton('checkout/session');
$discount = $session->getData('webpos_admin_discount');
if (!$discount) {
return $this;
}
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
$session->setData('webpos_admin_discount', $discount);
$address->setWebposDiscountAmount($discount);
$address->setData('webpos_discount_amount', $discount);
/* Daniel - tax for discount */
$afterDiscount = Mage::getStoreConfig('tax/calculation/apply_after_discount');
if ($afterDiscount) {
$country = Mage::getModel('checkout/session')->getQuote()->getShippingAddress()->getCountry();
$oldTax = $address->getTaxAmount();
$oldBaseTax = $address->getBaseTaxAmount();
if ($country) {
$rateTax = Mage::getModel('tax/calculation_rate')->getCollection()->addFieldToFilter('tax_country_id', $country)->setOrder('rate', 'DESC')->getFirstItem();
$address->setTaxAmount(($address->getBaseSubtotal() - $discount + $address->getShippingAmount() + $address->getDiscountAmount()) * $rateTax->getRate() / 100)->setBaseTaxAmount(($address->getBaseSubtotal() - $discount + $address->getShippingAmount() + $address->getDiscountAmount()) * $rateTax->getRate() / 100);
$taxCalculationModel = Mage::getSingleton('tax/calculation');
$request = Mage::getSingleton('tax/calculation')->getRateRequest($address, $address->getQuote()->getBillingAddress(), $address->getQuote()->getCustomerTaxClassId(), $store);
$rate = Mage::getSingleton('tax/calculation')->getRate($request);
$this->_saveAppliedTaxes($address, $taxCalculationModel->getAppliedRates($request), $address->getTaxAmount(), $address->getBaseTaxAmount(), $rate);
}
$address->setGrandTotal($address->getGrandTotal() - $address->getWebposDiscountAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getWebposDiscountAmount());
} else {
$address->setGrandTotal($address->getGrandTotal() - $address->getWebposDiscountAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getWebposDiscountAmount());
}
/* end */
return $this;
}
示例9: fetch
/**
* Add tax totals information to address object
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Tax_Model_Sales_Total_Quote
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$applied = $address->getAppliedTaxes();
$store = $address->getQuote()->getStore();
$amount = $address->getTaxAmount();
$area = null;
if ($this->_config->displayCartTaxWithGrandTotal($store) && $address->getGrandTotal()) {
$area = 'taxes';
}
if ($amount != 0 || $this->_config->displayCartZeroTax($store)) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $applied ? $applied : array(), 'value' => $amount, 'area' => $area));
}
$store = $address->getQuote()->getStore();
/**
* Modify subtotal
*/
if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
if ($address->getSubtotalInclTax() > 0) {
$subtotalInclTax = $address->getSubtotalInclTax();
} else {
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
}
$address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}
示例10: fetch
/**
* Add tax totals information to address object
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Tax_Model_Sales_Total_Quote
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$applied = $address->getAppliedTaxes();
$store = $address->getQuote()->getStore();
$amount = $address->getTaxAmount();
$items = $this->_getAddressItems($address);
$discountTaxCompensation = 0;
foreach ($items as $item) {
$discountTaxCompensation += $item->getDiscountTaxCompensation();
}
$taxAmount = $amount + $discountTaxCompensation;
/*
* when weee discount is not included in extraTaxAmount, we need to add it to the total tax
*/
if ($this->_weeeHelper->isEnabled()) {
if (!$this->_weeeHelper->includeInSubtotal()) {
$taxAmount += $address->getWeeeDiscount();
}
}
$area = null;
if ($this->_config->displayCartTaxWithGrandTotal($store) && $address->getGrandTotal()) {
$area = 'taxes';
}
if ($amount != 0 || $this->_config->displayCartZeroTax($store)) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $applied ? $applied : array(), 'value' => $amount, 'area' => $area));
}
$store = $address->getQuote()->getStore();
/**
* Modify subtotal
*/
if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
if ($address->getSubtotalInclTax() > 0) {
$subtotalInclTax = $address->getSubtotalInclTax();
} else {
$subtotalInclTax = $address->getSubtotal() + $taxAmount - $address->getShippingTaxAmount();
}
$address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}
示例11: fetch
/**
* Add tax totals information to address object
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Tax_Model_Sales_Total_Quote
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$config = Mage::getSingleton('tax/config');
$quote = $address->getQuote();
$store = $quote->getStore();
$amount = $address->getTaxAmount();
$fullInfo = array();
$summary = Mage::getModel('avatax/avatax_estimate')->getSummary($address->getId());
foreach ($summary as $key => $row) {
$id = 'avatax-' . $key;
$fullInfo[$id] = array('rates' => array(array('code' => $row['name'], 'title' => $row['name'], 'percent' => $row['rate'], 'position' => $key, 'priority' => $key, 'rule_id' => 0)), 'percent' => $row['rate'], 'id' => $id, 'process' => 0, 'amount' => $row['amt'], 'base_amount' => $row['amt']);
}
if ($amount != 0 || Mage::helper('tax')->displayZeroTax($store)) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $fullInfo, 'value' => $amount, 'area' => null));
}
/**
* Modify subtotal
*/
if (method_exists($config, "displayCartSubtotalBoth") && method_exists($config, "displayCartSubtotalInclTax") && ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store))) {
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
$address->setSubtotalInclTax($subtotalInclTax);
$address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}
示例12: fetch
/**
* Add tax totals information to address object
*
* @param Mage_Sales_Model_Quote_Address $address
* @return $this
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$config = Mage::getSingleton('tax/config');
$quote = $address->getQuote();
$store = $quote->getStore();
$amount = $address->getTaxAmount();
if ($amount != 0 || Mage::helper('tax')->displayZeroTax($store)) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $address->getAppliedTaxes(), 'value' => $amount, 'area' => null));
}
/**
* Modify subtotal
*/
if (method_exists($config, "displayCartSubtotalBoth") && method_exists($config, "displayCartSubtotalInclTax") && ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store))) {
if ($address->getSubtotalInclTax() > 0) {
$subtotalInclTax = $address->getSubtotalInclTax();
} else {
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
}
$address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}
示例13: calculateCartTotal
/**
* Calculate cart total net
*
* @param Mage_Sales_Model_Quote_Address $address
* @return int
*/
private function calculateCartTotal($address)
{
if ($address->getTaxAmount() > 0) {
$value = $address->getGrandTotal() - $address->getTaxAmount();
return $this->currencyToSmallerUnit($value);
} else {
$discount = $address->getDiscountAmount() < 0 ? -$address->getDiscountAmount() : $address->getDiscountAmount();
$value = $address->getSubtotal() + $address->getShippingAmount() + $this->getQuote()->getBillpayChargedFeeNet() - $discount;
// TODO: for rate payment add fee tax amount
return $this->currencyToSmallerUnit($value);
}
}