Correct way to integrate ERP system

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
michal.fehér
Posts: 44
Joined: 05 Feb 2018, 09:57

Correct way to integrate ERP system

Post by michal.fehér » 12 Apr 2018, 15:01

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.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Correct way to integrate ERP system

Post by aimeos » 13 Apr 2018, 17:37

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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

michal.fehér
Posts: 44
Joined: 05 Feb 2018, 09:57

Re: Correct way to integrate ERP system

Post by michal.fehér » 18 Apr 2018, 08:40

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.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Correct way to integrate ERP system

Post by aimeos » 19 Apr 2018, 07:35

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

michal.fehér
Posts: 44
Joined: 05 Feb 2018, 09:57

Re: Correct way to integrate ERP system

Post by michal.fehér » 19 Apr 2018, 11:42

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.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Correct way to integrate ERP system

Post by aimeos » 20 Apr 2018, 08:47

Thanks, this has been fixed in the docs.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply