I just very curiously how magento can process this . Default when create shipment with set item qty to zero. It's will not visible in shipment But i can't find file to process this Can anyone show me the file or any snippets
1 Answer
When you set 0 for some product and submit shipment, Post data will be something like:
Array
(
[items] => Array
(
[648] => 0
[650] => 5
)
[comment_text] =>
)
Now open
app/code/core/Mage/Sales/Model/Service/Order.php
And check the following method:
protected function _canShipItem($item, $qtys=array())
{
if ($item->getIsVirtual() || $item->getLockedDoShip()) {
return false;
}
$this->updateLocaleNumbers($qtys);
if ($item->isDummy(true)) {
if ($item->getHasChildren()) {
if ($item->isShipSeparately()) {
return true;
}
foreach ($item->getChildrenItems() as $child) {
if ($child->getIsVirtual()) {
continue;
}
if (empty($qtys)) {
if ($child->getQtyToShip() > 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->getQtyToShip() > 0;
} else {
return isset($qtys[$parent->getId()]) && $qtys[$parent->getId()] > 0;
}
}
} else {
return $item->getQtyToShip()>0;
}
}
-
thanks for your time but i can't find the code above in file mentioned. Your current magento version ?– mrtuvnMar 8, 2019 at 16:45