本文整理汇总了PHP中Mage_Sales_Model_Order_Creditmemo类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Creditmemo类的具体用法?PHP Mage_Sales_Model_Order_Creditmemo怎么用?PHP Mage_Sales_Model_Order_Creditmemo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Order_Creditmemo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: setEntity
/**
* Set entity
*
* @param Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
* @return $this
*/
public function setEntity($object)
{
$this->setEntityId($object->getId());
$this->setEntityIncrementId($object->getIncrementId());
$this->setStoreId($object->getStoreId());
return $this;
}
开发者ID:onepica,项目名称:avatax,代码行数:13,代码来源:Queue.php
示例3: process
/**
* Save order in AvaTax system
*
* @see OnePica_AvaTax_Model_Observer_SalesOrderCreditmemoSaveAfter::execute()
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @param OnePica_AvaTax_Model_Records_Queue $queue
* @return mixed
* @throws OnePica_AvaTax_Exception
* @throws OnePica_AvaTax_Model_Service_Exception_Commitfailure
* @throws OnePica_AvaTax_Model_Service_Exception_Unbalanced
*/
public function process($creditmemo, $queue)
{
$order = $creditmemo->getOrder();
$storeId = $order->getStoreId();
$this->setStoreId($storeId);
$shippingAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
if (!$shippingAddress) {
throw new OnePica_AvaTax_Exception($this->_getHelper()->__('There is no address attached to this order'));
}
/** @var OnePica_AvaTax_Model_Service_Result_Creditmemo $creditmemoResult */
$creditmemoResult = $this->_getService()->creditmemo($creditmemo, $queue);
//if successful
if (!$creditmemoResult->getHasError()) {
$message = $this->_getHelper()->__('Credit memo #%s was saved to AvaTax', $creditmemoResult->getDocumentCode());
$this->_getHelper()->addStatusHistoryComment($order, $message);
$totalTax = $creditmemoResult->getTotalTax();
if ($totalTax != $creditmemo->getBaseTaxAmount() * -1) {
throw new OnePica_AvaTax_Model_Service_Exception_Unbalanced('Collected: ' . $creditmemo->getTaxAmount() . ', Actual: ' . $totalTax);
}
//if not successful
} else {
$messages = $creditmemoResult->getErrors();
throw new OnePica_AvaTax_Model_Service_Exception_Commitfailure(implode(' // ', $messages));
}
return true;
}
开发者ID:onepica,项目名称:avatax,代码行数:37,代码来源:Creditmemo.php
示例4: 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
示例5: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$order_id = $creditmemo->getOrderId();
$order = Mage::getModel('sales/order')->load($order_id);
$creditmemo->setFeeAmount($order->getFeeAmount());
$creditmemo->setBaseFeeAmount($order->getBaseFeeAmount());
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $creditmemo->getFeeAmount());
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $creditmemo->getBaseFeeAmount());
return $this;
}
开发者ID:axovel,项目名称:exqzt,代码行数:10,代码来源:Creditmemo.php
示例6: 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
示例7: collect
/**
* Collect total cost of refunded items
*
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @return Mage_Sales_Model_Order_Creditmemo_Total_Cost
*/
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$baseRefundTotalCost = 0;
foreach ($creditmemo->getAllItems() as $item) {
if (!$item->getHasChildren()) {
$baseRefundTotalCost += $item->getBaseCost() * $item->getQty();
}
}
$creditmemo->setBaseCost($baseRefundTotalCost);
return $this;
}
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:17,代码来源:Cost.php
示例8: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
if (!$creditmemo->getInvoice() || !$creditmemo->getInvoice()->getId()) {
return;
}
$order = $creditmemo->getOrder();
if ($order->getWebposChange() < 0.0001) {
return;
}
$creditmemo->setWebposChange($order->getWebposChange())->setWebposBaseChange($order->getWebposBaseChange());
}
开发者ID:javik223,项目名称:Evron-Magento,代码行数:11,代码来源:Change.php
示例9: getCurrency
/**
* Returns the currency compliant to ISO 4217 (3 char code)
* @return string 3 Character long currency code
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
* @return string
*/
public function getCurrency($object)
{
$currency = $object->getBaseCurrencyCode();
if (!Mage::helper('paymill/optionHelper')->isBaseCurrency()) {
if ($object instanceof Mage_Sales_Model_Quote) {
$currency = $object->getQuoteCurrencyCode();
} else {
$currency = $object->getOrderCurrencyCode();
}
}
return $currency;
}
开发者ID:SiWe0401,项目名称:paymill-magento,代码行数:19,代码来源:PaymentHelper.php
示例10: refund
*
* @category FCM
* @package FCM_Fulfillment
* @author Pawan Prakash Gupta
* @author_id 51405591
* @company HCL Technologies
* @created Monday, August 13, 2012
* @copyright Four cross media
*/
/**
* Orderpayment model class
*
* @category FCM
* @package FCM_Fulfillment
* @author Pawan Prakash Gupta <51405591>
*/
class FCM_Fulfillment_Model_Salespayment extends Mage_Sales_Model_Order_Payment
{
/**
* Refund payment online or offline, depending on whether there is invoice set in the creditmemo instance
* Updates transactions hierarchy, if required
* Updates payment totals, updates order status and adds proper comments
*
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @return Mage_Sales_Model_Order_Payment
*/
public function refund($creditmemo)
{
$baseAmountToRefund = $this->_formatAmount($creditmemo->getBaseGrandTotal());
$order = $this->getOrder();
$this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
// call refund from gateway if required
$isOnline = false;
$gateway = $this->getMethodInstance();
$invoice = null;
if ($gateway->canRefund() && $creditmemo->getDoTransaction()) {
$this->setCreditmemo($creditmemo);
$invoice = $creditmemo->getInvoice();
if ($invoice) {
$isOnline = true;
$captureTxn = $this->_lookupTransaction($invoice->getTransactionId());
if ($captureTxn) {
$this->setParentTransactionId($captureTxn->getTxnId());
}
$this->setShouldCloseParentTransaction(true);
// TODO: implement multiple refunds per capture
try {
$gateway->setStore($this->getOrder()->getStoreId())->processBeforeRefund($invoice, $this)->refund($this, $baseAmountToRefund)->processCreditmemo($creditmemo, $this);
} catch (Mage_Core_Exception $e) {
if (!$captureTxn) {
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:50,代码来源:Salespayment.php
示例11: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$order = $creditmemo->getOrder();
$totalDiscountAmount = $order->getMwStorecreditDiscountShow();
$baseTotalDiscountAmount = $order->getMwStorecreditDiscount();
/* $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $totalDiscountAmount);
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $baseTotalDiscountAmount); */
$creditmemo->setGrandTotal($creditmemo->getGrandTotal());
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal());
$creditmemo->setMwStorecredit($order->getMwStorecredit());
$creditmemo->setMwStorecreditBuyCredit($order->getMwStorecreditBuyCredit());
$creditmemo->setMwStorecreditDiscount($baseTotalDiscountAmount);
$creditmemo->setMwStorecreditDiscountShow($totalDiscountAmount);
return $this;
}
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:15,代码来源:Storecredit.php
示例12: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$creditmemo->setWebposGiftwrapAmount(0);
$orderGiftwrapAmount = $creditmemo->getOrder()->getWebposGiftwrapAmount();
$baseOrderShippingAmount = $creditmemo->getOrder()->getWebposGiftwrapAmount();
if ($orderGiftwrapAmount) {
$creditmemo->setWebposGiftwrapAmount($orderGiftwrapAmount);
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $orderGiftwrapAmount);
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $orderGiftwrapAmount);
}
return $this;
}
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:12,代码来源:Giftwrap.php
示例13: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$creditmemo->setSurchargeAmount(0);
$creditmemo->setBaseSurchargeAmount(0);
$orderSurchargeAmount = Mage::helper('sagepaysurcharges')->getAmount($creditmemo->getOrder()->getId());
if (!$orderSurchargeAmount) {
$orderSurchargeAmount = Mage::getSingleton('core/session')->getData('surchargeamount');
}
if ($orderSurchargeAmount) {
$creditmemo->setSurchargeAmount($orderSurchargeAmount);
$creditmemo->setBaseSurchargeAmount($orderSurchargeAmount);
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $orderSurchargeAmount);
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $orderSurchargeAmount);
}
return $this;
}
开发者ID:GaynorH,项目名称:prestigedrinks,代码行数:16,代码来源:Surcharge.php
示例14: testSendEmail
/**
* @magentoConfigFixture current_store design/theme/full_name default/default/default
* @magentoDataFixture Mage/Sales/_files/order.php
*/
public function testSendEmail()
{
$order = new Mage_Sales_Model_Order();
$order->loadByIncrementId('100000001');
$order->setCustomerEmail('[email protected]');
$creditmemo = new Mage_Sales_Model_Order_Creditmemo();
$creditmemo->setOrder($order);
$payment = $order->getPayment();
$paymentInfoBlock = Mage::helper('Mage_Payment_Helper_Data')->getInfoBlock($payment);
$paymentInfoBlock->setArea('invalid-area');
$payment->setBlockMock($paymentInfoBlock);
$this->assertEmpty($creditmemo->getEmailSent());
$creditmemo->sendEmail(true);
$this->assertNotEmpty($creditmemo->getEmailSent());
$this->assertEquals('frontend', $paymentInfoBlock->getArea());
}
开发者ID:nayanchamp,项目名称:magento2,代码行数:20,代码来源:CreditmemoTest.php
示例15: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$order = $creditmemo->getOrder();
$amount = $order->getServicecostInvoiced() - $order->getServicecostRefunded();
$baseamount = $order->getBaseServicecostInvoiced() - $order->getBaseServicecostRefunded();
$taxamount = $order->getServicecostTaxInvoiced() - $order->getServicecostTaxRefunded();
$basetaxamount = $order->getBaseServicecostTaxInvoiced() - $order->getBaseServicecostTaxRefunded();
if ($baseamount > 0) {
$creditmemo->setServicecost($amount);
$creditmemo->setBaseServicecost($baseamount);
$creditmemo->setServicecostTax($order->getServicecostTaxRefunded());
$creditmemo->setBaseServicecostTax($order->getBaseServicecostTaxRefunded());
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $amount + $taxamount - $order->getServicecostTax());
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseamount + $basetaxamount - $order->getServicecostTax());
}
return $this;
}
开发者ID:xiaoguizhidao,项目名称:storebaby.it,代码行数:17,代码来源:Total.php
示例16: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$_helper = Mage::helper('msp_cashondelivery');
$_model = Mage::getModel('msp_cashondelivery/cashondelivery');
$order = $creditmemo->getOrder();
$baseAmount = $order->getMspBaseCashondelivery();
$baseAmountInclTax = $order->getMspBaseCashondeliveryInclTax();
$amount = $order->getMspCashondelivery();
$amountInclTax = $order->getMspCashondeliveryInclTax();
$codTax = $amountInclTax - $amount;
$codBaseTax = $baseAmountInclTax - $baseAmount;
$creditmemo->setTaxAmount($creditmemo->getTaxAmount() + $codTax);
$creditmemo->setBaseTaxAmount($creditmemo->getBaseTaxAmount() + $codBaseTax);
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $codTax);
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $codBaseTax);
return $this;
}
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:17,代码来源:Tax.php
示例17: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$order = $creditmemo->getOrder();
$invoice = $order->getInvoiceCollection()->getFirstItem();
$payment = $order->getPayment();
$paymentMethod = $payment->getMethod();
if ($this->getHelper()->isBillpayRatPayment($paymentMethod)) {
$info = $payment->getMethodInstance()->getInfoInstance();
// Temporary set creditmemo amount to current amount (will be overriden after partialCancel-request was successful)
$creditmemo->setBillpayRateSurcharge($info->getBillpayRateSurcharge());
$creditmemo->setBillpayRateFee($info->getBillpayRateFee());
$creditmemo->setBillpayRateFeeNet($info->getBillpayRateFeeNet());
$creditmemo->setBillpayRateTotalAmount($info->getBillpayRateTotalAmount());
$creditmemo->setBillpayRateFeeTax($info->getBillpayRateFeeTax());
// TODO: ...
/*if ($diff < 0 && -$diff = $feeTaxAmount) { // must be a full cancel
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $feeTaxAmount);
}
else if ($diff == 0) {
$creditmemo->setTaxAmount($creditmemo->getTaxAmount() + $feeTaxAmount);
}
$diffBase = $order->getBaseGrandTotal() - $order->getBaseTotalRefunded() - $creditmemo->getBaseGrandTotal();
if ($diffBase < 0 && -$diffBase = $feeTaxAmount) { // must be a full cancel
$creditmemo->setBaseGrandTotal($creditmemo->getGrandTotal() - $feeTaxAmount);
}
else if ($diff == 0) {
$creditmemo->setBaseTaxAmount($creditmemo->getBaseTaxAmount() + $feeTaxAmount);
}*/
}
return $this;
}
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:32,代码来源:Surcharge.php
示例18: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $invoice)
{
$order = $invoice->getOrder();
$amount = $order->getMspCashondelivery();
$baseAmount = $order->getMspBaseCashondelivery();
$invoice->setGrandTotal($invoice->getGrandTotal() + $amount);
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseAmount);
$invoice->setMspCashondelivery($amount);
$invoice->setMspBaseCashondelivery($baseAmount);
return $this;
}
开发者ID:kushhot,项目名称:mostimportantmgdata,代码行数:11,代码来源:Total.php
示例19: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$creditmemo->setWebposDiscountAmount(0);
$orderWebposDiscount = $creditmemo->getOrder()->getWebposDiscountAmount();
if ($orderWebposDiscount) {
$creditmemo->setWebposDiscountAmount($orderWebposDiscount);
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $orderWebposDiscount);
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $orderWebposDiscount);
}
return $this;
}
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:11,代码来源:Discount.php
示例20: 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
注:本文中的Mage_Sales_Model_Order_Creditmemo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论