Page 1 of 1

Correct way to integrate ERP system

Posted: 12 Apr 2018, 15:01
by michal.fehér
Hi. According to documentation, the correct way how and where to integrate an ERP system is via Service providers (https://aimeos.org/docs/Developers/Library/Service).

But docs only mention delivery and payment providers. Our case is following: We want to push new order into our ERP system immediately when the order is placed. We dont want to wait until the order is shipped or paid.
What would be the best thing to do? Create new Service provider (similar to one of the existing delivery/payment service provider) and create a new cron job to trigger this service provider, or somehow utilize the delivery provider to be triggered immediately when the order is placed?

First, I thought the basket plugin will be best for this scenario, but after I read docs it looks the service providers is better place where to store this logic - and I can leverage the cron jobs.

Thanks.

Re: Correct way to integrate ERP system

Posted: 13 Apr 2018, 17:37
by aimeos
Yes, implement a delivery service provider for this. Then you can push orders by cronjob every minute but you need some kind of payment provider that sets the payment status to authorized, even if it's doesn't do anything else. The "PostPay" provider does this for example.

Re: Correct way to integrate ERP system

Posted: 18 Apr 2018, 08:40
by michal.fehér
Thanks for the tip.

So I am creating a new delivery provider. In process method I accept \Aimeos\MShop\Order\Item\Iface $order.

How can I get products from this $order object? This returns empty array:
$this->getOrderBase($order->getId())->getProducts()

In DB everything looks correct.

Thanks.

Re: Correct way to integrate ERP system

Posted: 19 Apr 2018, 07:35
by aimeos
You have to use $order->getBaseId() and pass the PARTS_PRODUCTS constant to retrieve the ordered products too:
https://aimeos.org/docs/Developers/Libr ... lete_order

Re: Correct way to integrate ERP system

Posted: 19 Apr 2018, 11:42
by michal.fehér
Works now, thank you.

I had to use
\Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT
instead of
\Aimeos\MShop\Order\Manager\Base\Base::PARTS_PRODUCT
as it was mentioned in docs. Not sure if docs are not corrent, but PARTS_PRODUCT wasnt found in Order\Manager\Base.

Re: Correct way to integrate ERP system

Posted: 20 Apr 2018, 08:47
by aimeos
Thanks, this has been fixed in the docs.