当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order_Creditmemo::getGrandTotal方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order_Creditmemo::getGrandTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Creditmemo::getGrandTotal方法的具体用法?PHP Mage_Sales_Model_Order_Creditmemo::getGrandTotal怎么用?PHP Mage_Sales_Model_Order_Creditmemo::getGrandTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order_Creditmemo的用法示例。


在下文中一共展示了Mage_Sales_Model_Order_Creditmemo::getGrandTotal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: collect

 /**
  * Collect customer balance totals for credit memo
  *
  * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
  * @return Enterprise_CustomerBalance_Model_Total_Creditmemo_Customerbalance
  */
 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $creditmemo->setBsCustomerBalTotalRefunded(0);
     $creditmemo->setCustomerBalTotalRefunded(0);
     $creditmemo->setBaseCustomerBalanceReturnMax(0);
     $creditmemo->setCustomerBalanceReturnMax(0);
     if (!Mage::helper('enterprise_customerbalance')->isEnabled()) {
         return $this;
     }
     $order = $creditmemo->getOrder();
     if ($order->getBaseCustomerBalanceAmount() && $order->getBaseCustomerBalanceInvoiced() != 0) {
         $cbLeft = $order->getBaseCustomerBalanceInvoiced() - $order->getBaseCustomerBalanceRefunded();
         $used = 0;
         $baseUsed = 0;
         if ($cbLeft >= $creditmemo->getBaseGrandTotal()) {
             $baseUsed = $creditmemo->getBaseGrandTotal();
             $used = $creditmemo->getGrandTotal();
             $creditmemo->setBaseGrandTotal(0);
             $creditmemo->setGrandTotal(0);
             $creditmemo->setAllowZeroGrandTotal(true);
         } else {
             $baseUsed = $order->getBaseCustomerBalanceInvoiced() - $order->getBaseCustomerBalanceRefunded();
             $used = $order->getCustomerBalanceInvoiced() - $order->getCustomerBalanceRefunded();
             $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $baseUsed);
             $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $used);
         }
         $creditmemo->setBaseCustomerBalanceAmount($baseUsed);
         $creditmemo->setCustomerBalanceAmount($used);
     }
     $creditmemo->setBaseCustomerBalanceReturnMax($creditmemo->getBaseCustomerBalanceReturnMax() + $creditmemo->getBaseGrandTotal());
     $creditmemo->setBaseCustomerBalanceReturnMax($creditmemo->getBaseCustomerBalanceReturnMax() + $creditmemo->getBaseCustomerBalanceAmount());
     $creditmemo->setCustomerBalanceReturnMax($creditmemo->getCustomerBalanceReturnMax() + $creditmemo->getCustomerBalanceAmount());
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:40,代码来源:Customerbalance.php

示例2: collect

 /**
  * Collect snap gift card account totals for credit memo
  *
  * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
  * @return $this
  */
 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $order = $creditmemo->getOrder();
     if ($order->getBaseSnapCardsAmount() && $order->getBaseSnapCardsInvoiced() != 0) {
         $gcaLeft = $order->getBaseSnapCardsInvoiced() - $order->getBaseSnapCardsRefunded();
         $used = 0;
         $baseUsed = 0;
         if ($gcaLeft >= $creditmemo->getBaseGrandTotal()) {
             $baseUsed = $creditmemo->getBaseGrandTotal();
             $used = $creditmemo->getGrandTotal();
             $creditmemo->setBaseGrandTotal(0);
             $creditmemo->setGrandTotal(0);
             $creditmemo->setAllowZeroGrandTotal(true);
         } else {
             $baseUsed = $order->getBaseSnapCardsInvoiced() - $order->getBaseSnapCardsRefunded();
             $used = $order->getSnapCardsInvoiced() - $order->getSnapCardsRefunded();
             $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $baseUsed);
             $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $used);
         }
         $creditmemo->setBaseSnapCardsAmount($baseUsed);
         $creditmemo->setSnapCardsAmount($used);
     }
     $creditmemo->setBaseCustomerBalanceReturnMax($creditmemo->getBaseCustomerBalanceReturnMax() + $creditmemo->getBaseSnapCardsAmount());
     $creditmemo->setCustomerBalanceReturnMax($creditmemo->getCustomerBalanceReturnMax() + $creditmemo->getSnapCardsAmount());
     $creditmemo->setCustomerBalanceReturnMax($creditmemo->getCustomerBalanceReturnMax() + $creditmemo->getGrandTotal());
     return $this;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:33,代码来源:Card.php

示例3: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     if (!$creditmemo->getInvoice() || !$creditmemo->getInvoice()->getId()) {
         return;
     }
     $order = $creditmemo->getOrder();
     if ($order->getWebposCash() < 0.0001 || $order->getGrandTotal() < 0.0001) {
         return;
     }
     $ratio = $creditmemo->getGrandTotal() / $order->getGrandTotal();
     $cash = $order->getWebposCash() * $ratio;
     $baseCash = $order->getWebposBaseCash() * $ratio;
     $maxcash = $order->getWebposCash();
     $maxbaseCash = $order->getWebposBaseCash();
     foreach ($order->getCreditmemosCollection() as $existedCreditmemo) {
         if ($maxcash > 0.0001) {
             $maxcash -= $existedCreditmemo->getWebposCash();
             $maxbaseCash -= $existedCreditmemo->getWebposBaseCash();
         }
     }
     if ($cash > $maxcash) {
         $cash = $maxcash;
         $baseCash = $maxbaseCash;
     }
     if ($cash > 0.0001) {
         $creditmemo->setWebposCash($cash)->setWebposBaseCash($baseCash);
         if ($creditmemo->getGrandTotal() <= $cash) {
             $creditmemo->setBaseGrandTotal(0.0)->setGrandTotal(0.0);
         } else {
             $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $cash)->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $baseCash);
         }
     }
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:33,代码来源:Cash.php

示例4: collect

 /**
  * Collect reward totals for credit memo
  *
  * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
  * @return Enterprise_Reward_Model_Total_Creditmemo_Reward
  */
 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $order = $creditmemo->getOrder();
     $rewardCurrecnyAmountLeft = $order->getRewardCurrencyAmountInvoiced() - $order->getRewardCurrencyAmountRefunded();
     $baseRewardCurrecnyAmountLeft = $order->getBaseRewardCurrencyAmountInvoiced() - $order->getBaseRewardCurrencyAmountRefunded();
     if ($order->getBaseRewardCurrencyAmount() && $baseRewardCurrecnyAmountLeft > 0) {
         if ($baseRewardCurrecnyAmountLeft >= $creditmemo->getBaseGrandTotal()) {
             $rewardCurrecnyAmountLeft = $creditmemo->getGrandTotal();
             $baseRewardCurrecnyAmountLeft = $creditmemo->getBaseGrandTotal();
             $creditmemo->setGrandTotal(0);
             $creditmemo->setBaseGrandTotal(0);
             $creditmemo->setAllowZeroGrandTotal(true);
         } else {
             $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $rewardCurrecnyAmountLeft);
             $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $baseRewardCurrecnyAmountLeft);
         }
         $pointValue = $order->getRewardPointsBalance() / $order->getBaseRewardCurrencyAmount();
         $rewardPointsBalance = $baseRewardCurrecnyAmountLeft * ceil($pointValue);
         $rewardPointsBalanceLeft = $order->getRewardPointsBalance() - $order->getRewardPointsBalanceRefunded();
         if ($rewardPointsBalance > $rewardPointsBalanceLeft) {
             $rewardPointsBalance = $rewardPointsBalanceLeft;
         }
         $creditmemo->setRewardPointsBalance($rewardPointsBalance);
         $creditmemo->setRewardCurrencyAmount($rewardCurrecnyAmountLeft);
         $creditmemo->setBaseRewardCurrencyAmount($baseRewardCurrecnyAmountLeft);
     }
     return $this;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:34,代码来源:Reward.php

示例5: collect

 /**
  * Collect reward total for invoice
  *
  * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
  * @return Rewards_Model_Sales_Invoice_Total
  */
 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $order = $creditmemo->getOrder();
     if (!$order->getHasSpentPoints()) {
         return $this;
     }
     list($acc_diff, $acc_diff_base) = $this->getAccumulatedDiscounts($order);
     //@nelkaake -a 12/01/11: This will help us make sure we never go below $0
     $acc_diff = min($acc_diff, $creditmemo->getGrandTotal());
     $acc_diff_base = min($acc_diff_base, $creditmemo->getBaseGrandTotal());
     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $acc_diff);
     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $acc_diff_base);
     return $this;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:20,代码来源:Total.php

示例6: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $order = $creditmemo->getOrder();
     $amount = number_format($order->getGiftCardValue(), 2);
     if ($amount) {
         if ($creditmemo->getGrandTotal() - $amount < 0) {
             $creditmemo->setGrandTotal(number_format(0.0));
             $creditmemo->setBaseGrandTotal(number_format(0.0));
         } else {
             $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $amount);
             $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $amount);
         }
     }
     return $this;
 }
开发者ID:shakhawat4g,项目名称:MagentoExtensions,代码行数:15,代码来源:Creditmemo.php

示例7: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $order = $creditmemo->getOrder();
     $allowedAmount = $order->getShippingAmount() - $order->getShippingRefunded();
     $baseAllowedAmount = $order->getBaseShippingAmount() - $order->getBaseShippingRefunded();
     /**
      * Check if shipping amount was specified (from invoice or another source).
      * Using has magic method to allow setting 0 as shipping amount.
      */
     if ($creditmemo->hasBaseShippingAmount()) {
         $baseShippingAmount = Mage::app()->getStore()->roundPrice($creditmemo->getBaseShippingAmount());
         if ($baseShippingAmount < $baseAllowedAmount) {
             $shippingAmount = $allowedAmount * $baseShippingAmount / $baseAllowedAmount;
             $shippingAmount = Mage::app()->getStore()->roundPrice($shippingAmount);
         } elseif ($baseShippingAmount == $baseAllowedAmount) {
             $shippingAmount = $allowedAmount;
         } else {
             $baseAllowedAmount = $order->formatBasePrice($baseAllowedAmount);
             Mage::throwException(Mage::helper('sales')->__('Maximum shipping amount allowed to refound is: %s', $baseAllowedAmount));
         }
     } else {
         $baseShippingAmount = $baseAllowedAmount;
         $shippingAmount = $allowedAmount;
     }
     $creditmemo->setShippingAmount($shippingAmount);
     $creditmemo->setBaseShippingAmount($baseShippingAmount);
     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $shippingAmount);
     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseShippingAmount);
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:30,代码来源:Shipping.php

示例8: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $totalTax = 0;
     $baseTotalTax = 0;
     foreach ($creditmemo->getAllItems() as $item) {
         $orderItemTax = $item->getOrderItem()->getTaxAmount();
         $baseOrderItemTax = $item->getOrderItem()->getBaseTaxAmount();
         $orderItemQty = $item->getOrderItem()->getQtyOrdered();
         if ($orderItemTax && $orderItemQty) {
             $tax = $orderItemTax * $item->getQty() / $orderItemQty;
             $baseTax = $baseOrderItemTax * $item->getQty() / $orderItemQty;
             $tax = $creditmemo->getStore()->roundPrice($tax);
             $baseTax = $creditmemo->getStore()->roundPrice($baseTax);
             $item->setTaxAmount($tax);
             $item->setBaseTaxAmount($baseTax);
             $totalTax += $tax;
             $baseTotalTax += $baseTax;
         }
     }
     $creditmemo->setTaxAmount($totalTax);
     $creditmemo->setBaseTaxAmount($baseTotalTax);
     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $totalTax);
     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseTotalTax);
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:25,代码来源:Tax.php

示例9: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $order = $creditmemo->getOrder();
     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $order->getDesconto());
     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $order->getBaseDesconto());
     return $this;
 }
开发者ID:TalissonBento,项目名称:Pharmacy,代码行数:7,代码来源:Desconto.php

示例10: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $creditmemo->setPaymentCharge(0);
     $creditmemo->setBasePaymentCharge(0);
     $paymentCharge = $creditmemo->getOrder()->getPaymentCharge();
     $basePaymentCharge = $creditmemo->getOrder()->getBasePaymentCharge();
     // we moeten de btw meenemen in de berekening
     $paymentMethod = $creditmemo->getOrder()->getPayment()->getMethod();
     $taxClass = Mage::helper('pay_payment')->getPaymentChargeTaxClass($paymentMethod);
     $storeId = Mage::app()->getStore()->getId();
     $taxCalculationModel = Mage::getSingleton('tax/calculation');
     $request = $taxCalculationModel->getRateRequest($creditmemo->getOrder()->getShippingAddress(), $creditmemo->getOrder()->getBillingAddress(), null, $storeId);
     $request->setStore(Mage::app()->getStore());
     $rate = $taxCalculationModel->getRate($request->setProductClassId($taxClass));
     if ($rate > 0) {
         $baseChargeTax = round($creditmemo->getBasePaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
         $chargeTax = round($creditmemo->getPaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
     } else {
         $baseChargeTax = 0;
         $chargeTax = 0;
     }
     $creditmemo->setPaymentCharge($paymentCharge);
     $creditmemo->setBasePaymentCharge($basePaymentCharge);
     $creditmemo->setBaseTaxAmount($creditmemo->getBaseTaxAmount() + $baseChargeTax);
     $creditmemo->setTaxAmount($creditmemo->getTaxAmount() + $chargeTax);
     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $creditmemo->getPaymentCharge());
     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $creditmemo->getBasePaymentCharge());
     return $this;
 }
开发者ID:paynl,项目名称:magento-plugin,代码行数:29,代码来源:Paymentcharge.php

示例11: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $baseDiscount = 0;
     $discount = 0;
     foreach ($creditmemo->getAllItems() as $item) {
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $orderItem = $item->getOrderItem();
         $orderItemDiscount = (double) $orderItem->getAffiliateplusAmount();
         $baseOrderItemDiscount = (double) $orderItem->getBaseAffiliateplusAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemDiscount && $orderItemQty) {
             $discount -= $orderItemDiscount * $item->getQty() / $orderItemQty;
             $baseDiscount -= $baseOrderItemDiscount * $item->getQty() / $orderItemQty;
         }
     }
     if (!floatval($baseDiscount)) {
         $order = $creditmemo->getOrder();
         $baseDiscount = $order->getBaseAffiliateplusDiscount();
         $discount = $order->getAffiliateplusDiscount();
     }
     if (floatval($baseDiscount)) {
         $baseDiscount = Mage::app()->getStore()->roundPrice($baseDiscount);
         $discount = Mage::app()->getStore()->roundPrice($discount);
         $creditmemo->setBaseAffiliateplusDiscount($baseDiscount);
         $creditmemo->setAffiliateplusDiscount($discount);
         $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseDiscount);
         $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $discount);
     }
     return $this;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:32,代码来源:Affiliateplus.php

示例12: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $creditmemo->setGomageGiftWrapAmount(0);
     $creditmemo->setBaseGomageGiftWrapAmount(0);
     $order = $creditmemo->getOrder();
     $totalGomageGiftWrapAmount = 0;
     $baseTotalGomageGiftWrapAmount = 0;
     foreach ($creditmemo->getAllItems() as $item) {
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $orderItemGomageGiftWrap = (double) $item->getOrderItem()->getGomageGiftWrapAmount();
         $baseOrderItemGomageGiftWrap = (double) $item->getOrderItem()->getBaseGomageGiftWrapAmount();
         $orderItemQty = $item->getOrderItem()->getQtyOrdered();
         if ($orderItemGomageGiftWrap && $orderItemQty) {
             $GomageGiftWrap = $orderItemGomageGiftWrap * $item->getQty() / $orderItemQty;
             $baseGomageGiftWrap = $baseOrderItemGomageGiftWrap * $item->getQty() / $orderItemQty;
             $GomageGiftWrap = $creditmemo->getStore()->roundPrice($GomageGiftWrap);
             $baseGomageGiftWrap = $creditmemo->getStore()->roundPrice($baseGomageGiftWrap);
             $item->setGomageGiftWrapAmount($GomageGiftWrap);
             $item->setBaseGomageGiftWrapAmount($baseGomageGiftWrap);
             $totalGomageGiftWrapAmount += $GomageGiftWrap;
             $baseTotalGomageGiftWrapAmount += $baseGomageGiftWrap;
         }
     }
     $creditmemo->setGomageGiftWrapAmount($totalGomageGiftWrapAmount);
     $creditmemo->setBaseGomageGiftWrapAmount($baseTotalGomageGiftWrapAmount);
     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $totalGomageGiftWrapAmount);
     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseTotalGomageGiftWrapAmount);
     return $this;
 }
开发者ID:jpedro21,项目名称:comerciodoboi,代码行数:31,代码来源:Giftwrap.php

示例13: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $cm)
 {
     $order = $cm->getOrder();
     if ($order->getPayment()->getMethodInstance()->getCode() != 'cashondelivery') {
         return $this;
     }
     $baseCmTotal = $cm->getBaseGrandTotal();
     $cmTotal = $cm->getGrandTotal();
     $baseCodFeeCredited = $order->getBaseCodFeeCredited();
     $codFeeCredited = $order->getCodFeeCredited();
     $baseCodFeeInvoiced = $order->getBaseCodFeeInvoiced();
     $codFeeInvoiced = $order->getCodFeeInvoiced();
     if ($cm->getInvoice()) {
         $invoice = $cm->getInvoice();
         $baseCodFeeToCredit = $invoice->getBaseCodFee();
         $codFeeToCredit = $invoice->getCodFee();
     } else {
         $baseCodFeeToCredit = $baseCodFeeInvoiced;
         $codFeeToCredit = $codFeeInvoiced;
     }
     if (!$baseCodFeeToCredit > 0) {
         return $this;
     }
     // Subtracting invoiced COD fee from Credit memo total
     //$cm->setBaseGrandTotal($baseCmTotal-$baseCodFeeToCredit);
     //$cm->setGrandTotal($cmTotal-$codFeeToCredit);
     //$cm->setBaseCodFee($baseCodFeeToCredit);
     //$cm->setCodFee($codFeeToCredit);
     //$order->setBaseCodFeeCredited($baseCodFeeCredited+$baseCodFeeToCredit);
     //$order->setCodFeeCredited($codFeeCredited+$baseCodFeeToCredit);
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:ecommerce,代码行数:32,代码来源:Total.php

示例14: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $creditmemo->setDiscountAmount(0);
     $creditmemo->setBaseDiscountAmount(0);
     $totalDiscountAmount = 0;
     $baseTotalDiscountAmount = 0;
     foreach ($creditmemo->getAllItems() as $item) {
         $orderItemDiscount = (double) $item->getOrderItem()->getDiscountAmount();
         $baseOrderItemDiscount = (double) $item->getOrderItem()->getBaseDiscountAmount();
         $orderItemQty = $item->getOrderItem()->getQtyOrdered();
         if ($orderItemDiscount && $orderItemQty) {
             $discount = $orderItemDiscount * $item->getQty() / $orderItemQty;
             $baseDiscount = $baseOrderItemDiscount * $item->getQty() / $orderItemQty;
             $discount = $creditmemo->getStore()->roundPrice($discount);
             $baseDiscount = $creditmemo->getStore()->roundPrice($baseDiscount);
             $item->setDiscountAmount($discount);
             $item->setBaseDiscountAmount($baseDiscount);
             $totalDiscountAmount += $discount;
             $baseTotalDiscountAmount += $baseDiscount;
         }
     }
     $creditmemo->setDiscountAmount($totalDiscountAmount);
     $creditmemo->setBaseDiscountAmount($baseTotalDiscountAmount);
     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $totalDiscountAmount);
     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $baseTotalDiscountAmount);
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:27,代码来源:Discount.php

示例15: collect

 public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $baseDiscount = 0;
     $discount = 0;
     $order = $creditmemo->getOrder();
     $baseOrderDiscount = $order->getBaseAffiliateCredit();
     $orderDiscount = $order->getAffiliateCredit();
     if ($creditmemo->getBaseGrandTotal() < 0.0001 || $baseOrderDiscount >= 0) {
         return $this;
     }
     $baseInvoicedDiscount = 0;
     $invoicedDiscount = 0;
     foreach ($order->getCreditmemosCollection() as $_creditmemo) {
         $baseInvoicedDiscount += $_creditmemo->getBaseAffiliateCredit();
         $invoicedDiscount += $_creditmemo->getAffiliateCredit();
     }
     $baseOrderTotal = $order->getBaseGrandTotal() - $baseOrderDiscount;
     $baseDiscount = $baseOrderDiscount * $creditmemo->getBaseGrandTotal() / $baseOrderTotal;
     $discount = $orderDiscount * $creditmemo->getBaseGrandTotal() / $baseOrderTotal;
     if ($baseDiscount < $baseOrderDiscount) {
         $baseDiscount = $baseOrderDiscount;
         $discount = $orderDiscount;
     }
     if ($baseDiscount) {
         $baseDiscount = Mage::app()->getStore()->roundPrice($baseDiscount);
         $discount = Mage::app()->getStore()->roundPrice($discount);
         $creditmemo->setBaseAffiliateCredit($baseDiscount);
         $creditmemo->setAffiliateCredit($discount);
         $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseDiscount);
         $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $discount);
         $creditmemo->setAllowZeroGrandTotal(true);
     }
     return $this;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:34,代码来源:Credit.php


注:本文中的Mage_Sales_Model_Order_Creditmemo::getGrandTotal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。