Error :: canReturnItemToStock() or canParentReturnToStock()..

1
80
views
Advertisement

I got this error while credit memo ..
So i have placed this two function in
Mage/Adminhtml/Block/Sales/Items/Abstract.php

Here is the functions..
public function canReturnItemToStock($item=null) {
$canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT);
if (!is_null($item)) {
if (!$item->hasCanReturnToStock()) {
$product = Mage::getModel(‘catalog/product’)->load($item->getOrderItem()->getProductId());
if ( $product->getId() && $product->getStockItem()->getManageStock() ) {
$item->setCanReturnToStock(true);
}
else {
$item->setCanReturnToStock(false);
}
}
$canReturnToStock = $item->getCanReturnToStock();
}
return $canReturnToStock;
}

public function canParentReturnToStock($item = null)
{
$canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT);
if (!is_null($item)) {
if ( $item->getCreditmemo()->getOrder()->hasCanReturnToStock() ) {
$canReturnToStock = $item->getCreditmemo()->getOrder()->getCanReturnToStock();
}
} elseif ( $this->getOrder()->hasCanReturnToStock() ) {
$canReturnToStock = $this->getOrder()->getCanReturnToStock();
}
return $canReturnToStock;
}

I hope this will helpful….
Mayank Zalavadia

1 COMMENT

  1. Its a helpful information If you need a Designer of Developer for your Website then you can contact me.We take pride in our on time delivery and ability to meet quick turn around requests while exceeding customer quality demands.
    We offer a wide range of IT related solutions at extremely competitive prices, with quality that exceeds our customers’ best expectations.
    -sufalamtech.com