3

I want to get the quantity to ship when i click on submit shipment botton. Following is the image and the array i got.

enter image description here

code:

$qtyShipped = $this->getRequest()->getParam('shipment');
var_dump($qtyShipped);

It gives output as

array(2) { ["items"]=> array(1) { [31]=> string(1) "3" } ["comment_text"]=> string(0) "" }

value 31 is changing for each order. Please help me to solve this.

Thanks.

1

Table Name sales_order_item -> Field Name: qty_shipped or sales_shipment -> total_qty for that Magento\Sales\Model\Order\Shipment & getTotalQty

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$_order = $objectManager->get('Magento\Sales\Model\Order\Item')->load(<id>);
$getQtyShipped =  $_order->getQtyShipped();
9
  • Let me know if any issue @NitinPawar. Thanks
    – Jackson
    Dec 9 '16 at 7:26
  • Yes u can user this value. Because it's already in DB. So get & Update if u Want then Save it again. @NitinPawar
    – Jackson
    Dec 9 '16 at 7:37
  • No i think you not getting my question, i want to update the qty to ship value to 3 and it is 1 before. so when i access it from the database it will give me 1. Dec 9 '16 at 7:44
  • I think u need to set Shipment Quantity Value in Observer on Some Event llike when clicked on "Ship" button from Admin Right?
    – Jackson
    Dec 9 '16 at 8:03
  • yes. I want to use this quantity when i ship the product. Dec 9 '16 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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