0

We are using Marketplace extension in my site, so seller also can process there own order.

i add custom order status i need to generate shipping slip after change that status

 public function shipmentorderAction(){
                $id = $this->getRequest()->getParam('id');

                $order = Mage::getModel('sales/order')->load($id);

                if($order->canShip())
{
    echo "check";
    exit();
$itemQty =  $order->getItemsCollection()->count();
    $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
    $shipment = new Mage_Sales_Model_Order_Shipment_Api();
    $shipmentId = $shipment->create($id);

}
                $order->setData('state', 'Shipment');
                $order->setStatus('Shipment');
                $history = $order->addStatusHistoryComment('', false);
                $history->setIsCustomerNotified(false);
                $order->save(); 

                $order->sendOrderUpdateEmail(true, null);

                $this->_getSession()->addSuccess(
                    $this->__('This Order has been Shipped Successfully')
                );
                //$this->_redirect('mpshippingmanager/shipping/index');
                Mage::getSingleton('core/session') ->addSuccess('Order Updated Successfully'); $this->_redirectReferer();


                }
1

$order = Mage::getModel('sales/order')->load($id); after that add this code for creating the shipment

if($order->canShip())
{
$itemQty =  $order->getItemsCollection()->count();
    $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
    $shipment = new Mage_Sales_Model_Order_Shipment_Api();
    $shipmentId = $shipment->create($id);

}
26
  • No it's not generate
    – Magento 2
    Jan 21 '16 at 9:22
  • check it is come inside that condition $order->canShip() Jan 21 '16 at 9:23
  • how to check i think it is not come
    – Magento 2
    Jan 21 '16 at 9:25
  • use echo something in that and exit.. and check if the order is invoiced Jan 21 '16 at 9:26
  • No it's not come that
    – Magento 2
    Jan 21 '16 at 9:30

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