Reputation: 726
I want to create M2epro Amazon Order object in Magento2.
This is due to some magento orders are not created because of inventory or product status. So I want to programatically create Amazon Order object and call createMagentoOrder().
File - m2epro/magento2-extension/Model/Order.php
Git Link - https://github.com/m2epro/magento2-extension
My Code -
$amazonobj = $objManager->get('\Ess\M2ePro\Model\Amazon\Order');
$amazonfactory = $amazonobj->get('\Ess\M2ePro\Model\ActiveRecord\Component\Parent\Amazon\Factory');
So after providing inventory and status to enable for product the magento 2 orders should be create.
I want to create Amazon Order object.
Any suggestion would be helpful.
Upvotes: 1
Views: 246
Reputation: 726
My Solution -
$amazonFactory = $objectManager->create('\Ess\M2ePro\Model\ActiveRecord\Component\Parent\Amazon\Factory');
$order = $amazonFactory->getObjectLoaded('Order', (int)$id);
$order->getLog()->setInitiator(\Ess\M2ePro\Helper\Data::INITIATOR_USER);
Upvotes: 0