2

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 1

0

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;
    }
}
1
  • thanks for your time but i can't find the code above in file mentioned. Your current magento version ?
    – mrtuvn
    Mar 8, 2019 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.