本文整理汇总了PHP中Mage_Sales_Model_Order_Creditmemo::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Creditmemo::getId方法的具体用法?PHP Mage_Sales_Model_Order_Creditmemo::getId怎么用?PHP Mage_Sales_Model_Order_Creditmemo::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Creditmemo
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Creditmemo::getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: isProcessedRefund
/**
* Check is processed refund
*
* @param \Mage_Sales_Model_Order_Creditmemo $creditmemo
* @param string $itemId
* @return boolean
*/
public function isProcessedRefund($creditmemo, $itemId)
{
$whRefund = Mage::getModel('inventoryplus/warehouse_refund')->loadByCreditmemoId($creditmemo->getId())->addFieldToFilter('item_id', $itemId)->getFirstItem();
if ($whRefund->getId()) {
return true;
}
return false;
}
示例3: _attachTotals
protected function _attachTotals(Mage_Sales_Model_Order_Creditmemo $creditMemo, $mode)
{
$total = $creditMemo->getGrandTotal();
$baseTotal = $creditMemo->getBaseGrandTotal();
$order = $creditMemo->getOrder();
$order->setForcedCanCreditmemo(false);
if ($mode == AW_Giftcard_Model_Source_Giftcard_Config_Refund::ALLOW_AFTER_REAL_MONEY_VALUE || $mode == AW_Giftcard_Model_Source_Giftcard_Config_Refund::NOT_ALLOW_VALUE) {
$_needBaseMoneyToRefund = abs($order->getBaseTotalPaid() - $order->getBaseTotalRefunded());
$_needMoneyToRefund = abs($order->getTotalPaid() - $order->getTotalRefunded());
$total = $creditMemo->getGrandTotal() - $_needMoneyToRefund;
$baseTotal = $creditMemo->getBaseGrandTotal() - $_needBaseMoneyToRefund;
}
if ($total <= 0 || $baseTotal <= 0) {
return $this;
}
$baseTotalGiftcardAmount = 0;
$totalGiftcardAmount = 0;
$creditmemoGiftCards = array();
if (null === $creditMemo->getId()) {
$invoiceGiftCards = Mage::helper('aw_giftcard/totals')->getInvoicedGiftCardsByOrderId($creditMemo->getOrder()->getId());
foreach ($invoiceGiftCards as $invoiceCard) {
$_baseGiftcardAmount = $invoiceCard->getBaseGiftcardAmount();
$_giftcardAmount = $invoiceCard->getGiftcardAmount();
$creditmemoItems = Mage::helper('aw_giftcard/totals')->getAllCreditmemoForGiftCard($creditMemo->getOrder()->getId(), $invoiceCard->getGiftcardId());
if (count($creditmemoItems) > 0) {
foreach ($creditmemoItems as $creditmemoGiftcard) {
$_baseGiftcardAmount -= $creditmemoGiftcard->getBaseGiftcardAmount();
$_giftcardAmount -= $creditmemoGiftcard->getGiftcardAmount();
}
}
$baseCardUsedAmount = $_baseGiftcardAmount;
if ($_baseGiftcardAmount >= $baseTotal) {
$baseCardUsedAmount = $baseTotal;
}
$baseTotal -= $baseCardUsedAmount;
$cardUsedAmount = $_giftcardAmount;
if ($_giftcardAmount >= $total) {
$cardUsedAmount = $total;
}
$total -= $cardUsedAmount;
$_baseGiftcardAmount = round($baseCardUsedAmount, 4);
$_giftcardAmount = round($cardUsedAmount, 4);
$baseTotalGiftcardAmount += $_baseGiftcardAmount;
$totalGiftcardAmount += $_giftcardAmount;
$_creditmemoCard = new Varien_Object($invoiceCard->getData());
$_creditmemoCard->setBaseGiftcardAmount($_baseGiftcardAmount)->setGiftcardAmount($_giftcardAmount);
array_push($creditmemoGiftCards, $_creditmemoCard);
}
}
if (null !== $creditMemo->getId() && $creditMemo->getAwGiftCards()) {
$creditmemoGiftCards = $creditMemo->getAwGiftCards();
foreach ($creditmemoGiftCards as $creditmemoCard) {
$baseTotalGiftcardAmount += $creditmemoCard->getBaseGiftcardAmount();
$totalGiftcardAmount += $creditmemoCard->getGiftcardAmount();
}
}
if (count($creditmemoGiftCards) > 0) {
$creditMemo->setAllowZeroGrandTotal(true);
}
$creditMemo->setAwGiftCards($creditmemoGiftCards)->setBaseAwGiftCardsAmount($baseTotalGiftcardAmount)->setAwGiftCardsAmount($totalGiftcardAmount)->setBaseGrandTotal($creditMemo->getBaseGrandTotal() - $baseTotalGiftcardAmount)->setGrandTotal($creditMemo->getGrandTotal() - $totalGiftcardAmount);
return $this;
}