本文整理汇总了PHP中Mage_Sales_Model_Quote_Address_Total_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address_Total_Abstract类的具体用法?PHP Mage_Sales_Model_Quote_Address_Total_Abstract怎么用?PHP Mage_Sales_Model_Quote_Address_Total_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Quote_Address_Total_Abstract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
/**
* @param Mage_Sales_Model_Quote_Address $address
*
* @return $this|Mage_Sales_Model_Quote_Address_Total_Abstract
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
if (Mage::helper("shopgate/config")->getIsMagentoVersionLower1410()) {
$items = $address->getAllItems();
} else {
$items = $this->_getAddressItems($address);
}
$shopgateOrder = Mage::getSingleton("core/session")->getData("shopgate_order");
if (!count($items) || is_null($shopgateOrder)) {
return $this;
//this makes only address type shipping to come through
}
$quote = $address->getQuote();
$amountShopPayment = $shopgateOrder->getAmountShopPayment();
if ($amountShopPayment >= 0) {
return $this;
}
$address->setShopgatePaymentFee($amountShopPayment);
$address->setBaseShopgatePaymentFee($amountShopPayment);
$quote->setShopgatePaymentFee($amountShopPayment);
$quote->setBaseShopgatePaymentFee($amountShopPayment);
$address->setGrandTotal($address->getGrandTotal() + $address->getShopgatePaymentFee());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseShopgatePaymentFee());
return $this;
}
示例2: collect
/**
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Abstract
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
$payment = $quote->getPayment();
if ($address->getAddressType() === 'billing') {
return $this;
}
$configId = $payment->getPayoneConfigPaymentMethodId();
if (empty($configId)) {
return $this;
}
$config = $this->helperConfig()->getConfigPaymentMethodById($configId, $quote->getStoreId());
if (empty($config)) {
return $this;
}
$feeConfig = $config->getFeeConfigForQuote($quote);
if (!is_array($feeConfig) or !array_key_exists('fee_config', $feeConfig)) {
return $this;
}
$paymentFee = $feeConfig['fee_config'];
$oldShippingAmount = $address->getBaseShippingAmount();
$newShippingAmount = $oldShippingAmount + $paymentFee;
$address->setBaseShippingAmount($newShippingAmount);
$address->setShippingAmount($quote->getStore()->convertPrice($newShippingAmount, false));
return parent::collect($address);
}
示例3: collect
/**
* Collect Weee taxes amount and prepare items prices for taxation and discount
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Weee_Model_Total_Quote_Weee
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
$this->_isTaxAffected = false;
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
}
$address->setAppliedTaxesReset(true);
$address->setAppliedTaxes(array());
$this->_store = $address->getQuote()->getStore();
$this->_helper->setStore($this->_store);
foreach ($items as $item) {
if ($item->getParentItemId()) {
continue;
}
$this->_resetItemData($item);
if ($item->getHasChildren() && $item->isChildrenCalculated()) {
foreach ($item->getChildren() as $child) {
$this->_resetItemData($child);
$this->_process($address, $child);
}
$this->_recalculateParent($item);
} else {
$this->_process($address, $item);
}
}
if ($this->_isTaxAffected) {
$address->unsSubtotalInclTax();
$address->unsBaseSubtotalInclTax();
}
return $this;
}
示例4: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$address->setBaseSubscriptionInitAmount(0);
$address->setSubscriptionInitAmount(0);
$this->_setAddress($address);
$this->_setAmount(0);
$this->_setBaseAmount(0);
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
}
$quote = $address->getQuote();
$baseInitAmount = $this->getInitAmount($quote);
$initAmount = $address->getQuote()->getStore()->convertPrice($baseInitAmount, false);
if (!Mage::registry('customweb_subscription_recurring_order') && $baseInitAmount) {
$address->setBaseSubscriptionInitAmount($baseInitAmount);
$address->setSubscriptionInitAmount($initAmount);
$quote->setBaseSubscriptionInitAmount($baseInitAmount);
$quote->setSubscriptionInitAmount($initAmount);
$address->setGrandTotal($address->getGrandTotal() + $initAmount);
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $initAmount);
$this->_calculateTax($address);
}
}
示例5: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
// Makes sure you only use the address type shipping
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
}
// reset totals by default (needed for some external checkout modules)
$address->setPaymentFeeAmount(0);
$address->setBasePaymentFeeAmount(0);
$adyenFeeHelper = Mage::helper('adyen_fee');
$this->_setAmount(0);
$this->_setBaseAmount(0);
$quote = $address->getQuote();
$val = $adyenFeeHelper->isPaymentFeeEnabled($quote);
if ($address->getAllItems() && $val) {
$basePaymentFee = $adyenFeeHelper->getPaymentFeeExclVat($address);
if ($basePaymentFee) {
$address->setPaymentFeeAmount($address->getQuote()->getStore()->convertPrice($basePaymentFee));
$address->setBasePaymentFeeAmount($basePaymentFee);
$address->setGrandTotal($address->getGrandTotal() + $address->getPaymentFeeAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentFeeAmount());
}
}
return $this;
}
示例6: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getQuote()->isVirtual()) {
if ($address->getData('address_type') == 'shipping') {
return $this;
}
} else {
if ($address->getData('address_type') == 'billing') {
return $this;
}
}
$this->_setAddress($address);
parent::collect($address);
$quote = $address->getQuote();
$amount = $quote->getMundipaggInterest();
if ($amount > 0) {
$this->_setBaseAmount(0.0);
$this->_setAmount(0.0);
$quote->getPayment()->setPaymentInterest($amount);
$address->setMundipaggInterest($amount);
$this->_setBaseAmount($amount);
$this->_setAmount($amount);
} else {
$this->_setBaseAmount(0.0);
$this->_setAmount(0.0);
$quote->getPayment()->setPaymentInterest(0.0);
$address->setMundipaggInterest(0.0);
}
return $this;
}
示例7: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$address->setDamageWaiverAmount(0);
$address->setBaseDamageWaiverAmount(0);
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
//this makes only address type shipping to come through
}
$quote = $address->getQuote();
$quote->setDamageWaiverAmount(0);
$depositAmt = ITwebexperts_Payperrentals_Helper_Price::getQuoteDamageWaiver($quote);
if ($depositAmt > 0) {
$exist_amount = $quote->getDamageWaiverAmount();
$fee = $depositAmt;
$balance = $fee - $exist_amount;
$address->setDamageWaiverAmount($balance);
$address->setBaseDamageWaiverAmount($balance);
$quote->setDamageWaiverAmount($balance);
} else {
$address->setDamageWaiverAmount(0);
$address->setBaseDamageWaiverAmount(0);
$quote->setDamageWaiverAmount(0);
}
return $this;
}
示例8: collect
/**
* Collect totals information about shipping
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$calc = $this->_calculator;
$store = $address->getQuote()->getStore();
$storeTaxRequest = $calc->getRateOriginRequest($store);
$addressTaxRequest = $calc->getRateRequest($address, $address->getQuote()->getBillingAddress(), $address->getQuote()->getCustomerTaxClassId(), $store);
$storeTaxRequest->setProductClassId($this->_config->getShippingTaxClass($store));
$addressTaxRequest->setProductClassId($this->_config->getShippingTaxClass($store));
$this->_areTaxRequestsSimilar = $calc->compareRequests($addressTaxRequest, $storeTaxRequest);
$shipping = $taxShipping = $address->getShippingAmount();
$baseShipping = $baseTaxShipping = $address->getBaseShippingAmount();
$rate = $calc->getRate($addressTaxRequest);
if ($this->_config->shippingPriceIncludesTax($store)) {
if ($this->_areTaxRequestsSimilar) {
$tax = $this->_round($calc->calcTaxAmount($shipping, $rate, true, false), $rate, true);
$baseTax = $this->_round($calc->calcTaxAmount($baseShipping, $rate, true, false), $rate, true, 'base');
$taxShipping = $shipping;
$baseTaxShipping = $baseShipping;
$shipping = $shipping - $tax;
$baseShipping = $baseShipping - $baseTax;
$taxable = $taxShipping;
$baseTaxable = $baseTaxShipping;
$isPriceInclTax = true;
} else {
$storeRate = $calc->getStoreRate($addressTaxRequest, $store);
$storeTax = $calc->calcTaxAmount($shipping, $storeRate, true, false);
$baseStoreTax = $calc->calcTaxAmount($baseShipping, $storeRate, true, false);
$shipping = $calc->round($shipping - $storeTax);
$baseShipping = $calc->round($baseShipping - $baseStoreTax);
$tax = $this->_round($calc->calcTaxAmount($shipping, $rate, false, false), false, $rate);
$baseTax = $this->_round($calc->calcTaxAmount($baseShipping, $rate, false, false), $rate, false, 'base');
$taxShipping = $shipping + $tax;
$baseTaxShipping = $baseShipping + $baseTax;
$taxable = $shipping;
$baseTaxable = $baseShipping;
$isPriceInclTax = false;
}
} else {
$tax = $this->_round($calc->calcTaxAmount($shipping, $rate, false, false), false, $rate);
$baseTax = $this->_round($calc->calcTaxAmount($baseShipping, $rate, false, false), $rate, false, 'base');
$taxShipping = $shipping + $tax;
$baseTaxShipping = $baseShipping + $baseTax;
$taxable = $shipping;
$baseTaxable = $baseShipping;
$isPriceInclTax = false;
}
$address->setTotalAmount('shipping', $shipping);
$address->setBaseTotalAmount('shipping', $baseShipping);
$address->setShippingInclTax($taxShipping);
$address->setBaseShippingInclTax($baseTaxShipping);
$address->setShippingTaxable($taxable);
$address->setBaseShippingTaxable($baseTaxable);
$address->setIsShippingInclTax($isPriceInclTax);
if ($this->_config->discountTax($store)) {
$address->setShippingAmountForDiscount($taxShipping);
$address->setBaseShippingAmountForDiscount($baseTaxShipping);
}
return $this;
}
示例9: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$this->_setAmount(0);
$this->_setBaseAmount(0);
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
//this makes only address type shipping to come through
}
$quote = $address->getQuote();
if (Excellence_Fee_Model_Fee::canApply($address)) {
$exist_amount = $quote->getFeeAmount();
$fee = Excellence_Fee_Model_Fee::getFee();
$balance = $fee - $exist_amount;
// $balance = $fee;
//$this->_setAmount($balance);
//$this->_setBaseAmount($balance);
$address->setFeeAmount($balance);
$address->setBaseFeeAmount($balance);
$quote->setFeeAmount($balance);
$address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());
}
}
示例10: collect
/**
* Collect address discount amount
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_SalesRule_Model_Quote_Discount
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$quote = $address->getQuote();
$store = Mage::app()->getStore($quote->getStoreId());
$this->_calculator->reset($address);
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
}
$eventArgs = array('website_id' => $store->getWebsiteId(), 'customer_group_id' => $quote->getCustomerGroupId(), 'coupon_code' => $quote->getCouponCode());
$this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());
$this->_calculator->initTotals($items, $address);
$address->setDiscountDescription(array());
$items = $this->_calculator->sortItemsByPriority($items);
foreach ($items as $item) {
if ($item->getNoDiscount()) {
$item->setDiscountAmount(0);
$item->setBaseDiscountAmount(0);
} else {
/**
* Child item discount we calculate for parent
*/
if ($item->getParentItemId()) {
continue;
}
$eventArgs['item'] = $item;
Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
if ($item->getHasChildren() && $item->isChildrenCalculated()) {
foreach ($item->getChildren() as $child) {
$this->_calculator->process($child);
$eventArgs['item'] = $child;
Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
$this->_aggregateItemDiscount($child);
}
} else {
$this->_calculator->process($item);
$this->_aggregateItemDiscount($item);
}
}
}
/**
* process weee amount
*/
if (Mage::helper('weee')->isEnabled() && Mage::helper('weee')->isDiscounted($store)) {
$this->_calculator->processWeeeAmount($address, $items);
}
/**
* Process shipping amount discount
*/
$address->setShippingDiscountAmount(0);
$address->setBaseShippingDiscountAmount(0);
if ($address->getShippingAmount()) {
$this->_calculator->processShippingAmount($address);
$this->_addAmount(-$address->getShippingDiscountAmount());
$this->_addBaseAmount(-$address->getBaseShippingDiscountAmount());
}
$this->_calculator->prepareDescription($address);
return $this;
}
示例11: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$_result = parent::fetch($address);
$giftCards = Mage::helper('aw_giftcard/totals')->getQuoteGiftCards($address->getQuote()->getId());
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('aw_giftcard')->__('Gift Cards'), 'value' => -$address->getAwGiftCardsAmount(), 'gift_cards' => $giftCards));
return $_result;
}
示例12: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
// Makes sure you only use the address type shipping
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
}
// reset totals by default (needed for onestepcheckout module)
$address->setPaymentPercentageFee(0);
$address->setBasePaymentPercentageFee(0);
$quote = $address->getQuote();
$adyenFeeHelper = Mage::helper('adyen_fee');
$paymentMethod = $quote->getPayment()->getMethod();
$percentageFee = $adyenFeeHelper->getHppPaymentMethodPercentageFee($paymentMethod);
if (!$percentageFee) {
return $this;
}
// minus the payment method fee inclusief tax if both are set
$paymentMethodFee = $address->getPaymentFeeAmount();
$paymentMethodFeeTax = $address->getPaymentFeeTax();
$grandTotal = $address->getGrandTotal() - ($paymentMethodFee + $paymentMethodFeeTax);
$fee = $address->getGrandTotal() / 100 * $percentageFee;
$grandTotal = $address->getGrandTotal();
$baseGrandTotal = $address->getBaseGrandTotal();
$address->setPaymentPercentageFee($address->getQuote()->getStore()->convertPrice($fee));
$address->setBasePaymentPercentageFee($fee);
$address->setGrandTotal($grandTotal + $address->getPaymentPercentageFee());
$address->setBaseGrandTotal($baseGrandTotal + $address->getBasePaymentPercentageFee());
return $this;
}
示例13: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
if ($address->getAddressType() != "shipping") {
return $this;
}
$this->address = $address;
$this->_resetValues();
if ($this->address->getQuote()->getId() == null) {
return $this;
}
$items = $this->address->getAllItems();
if (!count($items)) {
return $this;
}
$payment = $this->address->getQuote()->getPayment();
try {
$this->paymentMethod = $payment->getMethodInstance();
} catch (Mage_Core_Exception $e) {
return $this;
}
if (!$this->paymentMethod instanceof Mage_Payment_Model_Method_Abstract) {
return $this;
}
if ($this->paymentMethod->getCode() === 'billmateinvoice') {
$this->_initInvoiceFee();
}
return $this;
}
示例14: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$page = $_SERVER['REQUEST_URI'];
$onepage = "checkout/cart";
$onepagecheck = strpos($page, $onepage);
if ($onepagecheck !== false) {
return $this;
}
$this->_setAmount(0);
$this->_setBaseAmount(0);
if (count($address->getAllItems()) == 0) {
return $this;
}
$quote = $address->getQuote();
$payment = $quote->getPayment();
try {
$method = $payment->getMethodInstance();
} catch (Mage_Core_Exception $e) {
return $this;
}
if ($method->getCode() != 'billmateinvoice') {
return $this;
}
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
//this makes only address type shipping to come through
}
$invoiceFee = $baseInvoiceFee = Mage::helper('billmateinvoice')->replaceSeparator(Mage::getStoreConfig('payment/billmateinvoice/billmate_fee'));
$exist_amount = $quote->getFeeAmount();
if (Mage::getStoreConfig('payment/billmateinvoice/tax_class')) {
$data = Mage::helper('billmateinvoice')->getInvoiceFeeArray($invoiceFee, $address, $quote->getCustomerTaxClassId());
$invoiceFee = $data['base_incl'];
}
$this->_calculator = Mage::getSingleton('tax/calculation');
$calc = $this->_calculator;
$store = $address->getQuote()->getStore();
$addressTaxRequest = $calc->getRateRequest($address->getQuote()->getShippingAddress(), $address->getQuote()->getBillingAddress(), $address->getQuote()->getCustomerTaxClassId(), $store);
$paymentTaxClass = Mage::getStoreConfig('payment/billmateinvoice/tax_class');
$addressTaxRequest->setProductClassId($paymentTaxClass);
$rate = $calc->getRate($addressTaxRequest);
$taxAmount = $calc->calcTaxAmount($baseInvoiceFee, $rate, false, true);
$baseTaxAmount = $calc->calcTaxAmount($baseInvoiceFee, $rate, false, true);
$address->setPaymentTaxAmount($taxAmount);
$address->setBasePaymentTaxAmount($baseTaxAmount);
//
$address->setTaxAmount($address->getTaxAmount() + $taxAmount);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseTaxAmount);
/* clime: tax calculation end */
$address->setFeeAmount($baseInvoiceFee);
$address->setBaseFeeAmount($baseInvoiceFee);
$address->setFeeTaxAmount($taxAmount);
$address->setBaseFeeTaxAmount($baseTaxAmount);
$totInv = $baseInvoiceFee + $taxAmount;
$quote->setFeeAmount($baseInvoiceFee + $taxAmount);
$quote->setFeeTaxAmount($taxAmount);
$address->setGrandTotal($address->getGrandTotal() + $address->getBaseFeeAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());
}
示例15: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$totalItems = Mage::helper('checkout/cart')->getSummaryCount();
parent::collect($address);
$this->_setAmount(0);
$this->_setBaseAmount(0);
$items = $this->_getAddressItems($address);
if (!count($items)) {
return $this;
}
$quote = $address->getQuote();
$exist_amount = $quote->getFeeAmount();
$cod = Mage::helper("emipro_codpayment")->cod_charges($quote);
$fee = $cod["fees"];
$balance = $fee - $exist_amount;
try {
$balance = $balance / $totalItems;
} catch (Exception $e) {
}
if ($quote->getPayment()->getMethod() == "cashondelivery") {
$baseCurrencyCode = $quote->getBaseCurrencyCode();
$currentCurrencyCode = $quote->getQuoteCurrencyCode();
$CodChange = Mage::helper('directory')->currencyConvert($balance, $baseCurrencyCode, $currentCurrencyCode);
$address->setFeeAmount($CodChange);
$address->setBaseFeeAmount($balance);
$address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());
}
}