Ikoshop Posted November 18 Share Posted November 18 (edited) 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? Edited Friday at 01:58 PM by Ikoshop solved (see edit history) Link to comment Share on other sites More sharing options...
Daresh Posted November 18 Share Posted November 18 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 More sharing options...
Ikoshop Posted November 18 Author Share Posted November 18 OK, I'll run a local installation of prestashop and look into the webhooks. Thanks! Link to comment Share on other sites More sharing options...
Daresh Posted November 18 Share Posted November 18 Take a look here: https://devdocs.prestashop-project.org/8/modules/ Link to comment Share on other sites More sharing options...
ziobudda Posted November 19 Share Posted November 19 You need to create a module that use hook. This module contact the POS system. M Link to comment Share on other sites More sharing options...
Ikoshop Posted November 19 Author Share Posted November 19 (edited) 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 November 19 by Ikoshop (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now