本文整理汇总了PHP中Mage_Sales_Model_Order_Item::getQtyToRefund方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Item::getQtyToRefund方法的具体用法?PHP Mage_Sales_Model_Order_Item::getQtyToRefund怎么用?PHP Mage_Sales_Model_Order_Item::getQtyToRefund使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Item::getQtyToRefund方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _canRefundNoDummyItem
/**
* Check if no dummy order item can be refunded
*
* @param Mage_Sales_Model_Order_Item $item
* @param array $invoiceQtysRefundLimits
* @return bool
*/
protected function _canRefundNoDummyItem($item, $invoiceQtysRefundLimits = array())
{
if ($item->getQtyToRefund() < 0) {
return false;
}
if (isset($invoiceQtysRefundLimits[$item->getId()])) {
return $invoiceQtysRefundLimits[$item->getId()] > 0;
}
return true;
}
示例2: _canRefundItem
/**
* Check if order item can be refunded
*
* @param Mage_Sales_Model_Order_Item $item
* @param array $qtys
* @return bool
*/
protected function _canRefundItem($item, $qtys = array())
{
if ($item->isDummy()) {
if ($item->getHasChildren()) {
foreach ($item->getChildrenItems() as $child) {
if (empty($qtys)) {
if ($child->getQtyToRefund() > 0) {
return true;
}
} else {
if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) {
return true;
}
}
}
return false;
} else {
if ($item->getParentItem()) {
$parent = $item->getParentItem();
if (empty($qtys)) {
return $parent->getQtyToRefund() > 0;
} else {
return isset($qtys[$parent->getId()]) && $qtys[$parent->getId()] > 0;
}
}
}
} else {
return $item->getQtyToRefund() > 0;
}
}
示例3: returnOrderItem
/**
* Remove specific qty of order item from order
*
* @param Mage_Sales_Model_Order $order
* @param Mage_Sales_Model_Order_Item $orderItem
* @param null $qtyToReturn
* @return $this
*/
public function returnOrderItem(Mage_Sales_Model_Order $order, Mage_Sales_Model_Order_Item $orderItem, $qtyToReturn = null)
{
if (is_null($qtyToReturn)) {
$qtyToReturn = $orderItem->getQtyToRefund() + $orderItem->getQtyToCancel();
}
if ($qtyToReturn > 0 && $orderItem->getQtyToCancel() > 0) {
$qtyToCancel = min($qtyToReturn, $orderItem->getQtyToCancel());
$qtyToReturn -= $qtyToCancel;
$this->cancelOrderItem($orderItem, $qtyToCancel);
}
if ($qtyToReturn > 0 && $orderItem->getQtyToRefund() > 0) {
$creditMemo = $this->refundOrderItem($order, $orderItem, $qtyToReturn);
}
return $this;
}
示例4: _refundItem
/**
* update quantity to refund
*
* @param Mage_Sales_Model_Order_Item $item
* @param array() $dataQty
* @param int $keepQty
* @return array() $dataQty
*/
private function _refundItem($item, $dataQty, $keepQty = 0)
{
$refundQty = $item->getQtyToRefund() - $keepQty;
if ($refundQty > 0) {
// set quantity to refund
$dataQty[$item->getId()] = $refundQty;
// search child to by refund as well
$childItems = $item->getChildrenItems();
foreach ($childItems as $child) {
$dataQty = $this->_refundItem($child, $dataQty, $keepQty);
}
}
return $dataQty;
}