1

I am using ERPNext which has a JSON API and Prestashop. As an example, I want to save transactions and so forth TO ERPNext FROM Prestashop when a client makes a purchase on Prestashop.

In essence, I would like to create a "Logic Hook" that gets triggered on the Prestashop side when a CRUD action occurs.

Examples:

1) A new user registers on Prestashop: The user is created as a client on ERPNext.
2) A client places an order on Prestashop: An order is created in ERPNext.
3) A contact is made on Prestashop: A ticket is created in ERPNext.

Where would I place the custom code (in Prestashop) for doing so, and how would it get fired?

I do not necessarily want to create new modules in Prestashop, just hook into or extend current functionality.

I know that I can access Prestashop's API / Webservice, but ideally, I would like to push transactions from Prestashop to the ERP, not the other way around.

Any help would be greatly appreciated.

It would be great if someone could point me in the right direction.

Jacques
  • 1,649
  • 2
  • 14
  • 23

2 Answers2

2

Your best bet might be to setup your own service that sits between the two, using the Prestashop API to poll for changes (unless they offer a callback), process them and then call out to ERPNext to do what you need done.

Kevin Nagurski
  • 1,889
  • 11
  • 24
0

This answer assumes that you're use MySql or MariaDB at Prestashop side. The easiest and the most effective way would be to implement "AFTER INSERT" OR "BEFORE INSERT" triggers at the mysql database side of your Prestashop instance as opposed to modify php codes of the prestashop. This way also allows you to easily manage the version changes on the PrestaShop side. You need to implement three triggers in Prestashop database. This link shows how to implement a triggers in a mysql database.

Before start coding trigger codes, it's a good idea to determine which erpnext APIs you need from this link.

aog
  • 484
  • 3
  • 14