Jump to content

Plugin for Prestashop which queries external API?


Recommended Posts

Hi,

Our clients have requested that we develop a plugin for Prestashop which communicates with our POS system through our own API.

Ideally, sales or other stock changes effected on the webshop should be reflected in real-time in the POS system and vice versa. So far I have only found information pertaining to accessing the Prestashop API to update stock data in from outside but not the opposite (communicate from the webshop to the POS API).

Is what I'm looking to do feasible and if so is there any documentation I could use as a jump-off point?

Link to comment
Share on other sites

There is no such documentation, you need to know how your external API works and write your own code that querys it.

All you can use are PrestaShop hooks, that are launched in various situations and areas in the shop.

Link to comment
Share on other sites

OK, I'm getting started on this. I used the module generator just to create a template module, then I can start adding functionality to it

https://validator.prestashop.com/generator

I'm using Prestashop 8.2.0

I copied the unzipped folder from my basic model to the modules folder of Prestashop (using Docker, if that info is important).

I installed it with module manager. So far so good.

Now, the module doesn't do anything to I wanted to just check if I could get it to trigger with a basic line of code.

The module is set to hook on 'cart creation and update'.

I added one line to the php file of the module 

[sorry, the website blocked me posting the line of php code, it's just a simple alert message in the hookActionCartSave function]

and copied the files over to the prestashop server again.

Now, I don't know if I need to force this to update or restart the server to get it to reload the updated module, but when I process a sale in my front end, at no point does the JS alert box from the function appear.

I could be doing everything wrong, just need a little nudge in the right direction.

 

 

Edited by Ikoshop (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...