Questions around the TYPO3 integration and plugins as well as Flow and NeosCMS
Forum rules: Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#1808 by vikram
23 Aug 2015, 04:26
I was wondering if there is some feature to manage export of basic products details to an external accounting system based on Rest-api service. I also need to update the stock value from the accounting system.

Since the stock update is one way and not a sync I was thinking of creating a csv file from the rest-api and then do a csv import into Aimeos.

Are there better ways to do these?
Any tip/suggestion :idea:
#1809 by aimeos
23 Aug 2015, 10:47
vikram wrote:I was wondering if there is some feature to manage export of basic products details to an external accounting system based on Rest-api service. I also need to update the stock value from the accounting system.


Do you want to export the product details or the ordered products of customers?

vikram wrote:Since the stock update is one way and not a sync I was thinking of creating a csv file from the rest-api and then do a csv import into Aimeos.


That's possible for sure but would be only a work-around. You could create a job controller that asks the REST API directly to get all stock levels and update the stock information by using the product stock manager. You can use the product CSV import job controller as reference for writing your own job controller and the stock import processor for how stock updates are done.

Have a look at the code and documentation:
- https://aimeos.org/docs/Developers/Controller/Implement_job_controller
- https://github.com/aimeos/aimeos-core/tree/master/controller/jobs/src/Controller/Jobs/Product/Import/Csv
- https://github.com/aimeos/aimeos-core/blob/master/controller/common/src/Controller/Common/Product/Import/Csv/Processor/Stock/Default.php
#1810 by vikram
23 Aug 2015, 14:47
I need to export all products and orders when they are placed. The account system would also generate pdf invoices which I would need to import back into Aimeos.

Thank you for tip related to stock update.
#1811 by aimeos
23 Aug 2015, 15:19
vikram wrote:I need to export all products and orders when they are placed. The account system would also generate pdf invoices which I would need to import back into Aimeos.


This is the job of the delivery service providers. You should create a new one talking to the REST API of your account system and pushing the order to that system. You can use the default delivery service provider as reference:
- https://aimeos.org/docs/Developers/Library/Service
- https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Service/Provider/Delivery/Default.php

The delivery service providers are executed by one of the scheduler tasks which you have to enable and you have to configure the new service provider so it's used in the checkout process (delivery step): https://aimeos.org/docs/User_Manual/Administration_Interface/Service_details

You can store the path to the invoice PDF as order service attribute in the database: https://aimeos.org/docs/Developers/Library/Service/Supporting_methods#Add_or_update_service_attributes
When you update the delivery status of the order (maybe to "in progress"), a new e-mail is sent for that status and you can add a new subpart for the "email delivery" client that attaches the PDF to the e-mail. For that part, we would love to get a pull request from you ;-)
#1812 by vikram
23 Aug 2015, 15:52
Thank you for all the tips. It is going to take some time for me get familiar with those since I am very new to Aimoes.

One last request :)
I need to initialize the accounting system with products from Aimoes. And every time new products is added or modified it needs to be pushed to the Accounting system.

The Accounting system is being used only for stock data management and invoice generation. I guess from here the order would be marked as shipped or complete. They may have offline payment as well.
#1813 by aimeos
23 Aug 2015, 16:13
vikram wrote:Thank you for all the tips. It is going to take some time for me get familiar with those since I am very new to Aimoes.


You can do almost everything with Aimeos but that freedom adds some complexity to the system. Feel free to ask everything you don't understand yet :-)

vikram wrote:I need to initialize the accounting system with products from Aimoes. And every time new products is added or modified it needs to be pushed to the Accounting system.

The Accounting system is being used only for stock data management and invoice generation. I guess from here the order would be marked as shipped or complete. They may have offline payment as well.


If your client will use the Aimeos administration interface, you can hook into the product ExtJS controller and push the changes to the account system: https://github.com/aimeos/aimeos-core/blob/master/controller/extjs/src/Controller/ExtJS/Product/Default.php
The finish() method would be the best place and I would write a decorator so you don't need to touch the existing code or subclass the existing class.