Book Image

PrestaShop Module Development

By : Serny
Book Image

PrestaShop Module Development

By: Serny

Overview of this book

If you are a developer who is new to PrestaShop and wants to get a good foundation in development on the PrestaShop framework, this book is for you. It's assumed that you will have some experience with PHP5, jQuery, and HTML/CSS (no need to be an expert on it).
Table of Contents (13 chapters)
12
Index

Using web services


Since we decided to create a module that connects to web services, I created a small API sample so we can run some tests. It is available in a directory named api, which I have attached to the code of this chapter. Please take this directory and copy and paste it into your localhost root directory.

API description

Here's a quick summary of how this API works:

  • The testConnection method:

    • URL query string:

      http://localhost/api/[email protected]&mca_token=23c4380e50caf91f81793ac91d9bfde9&method=testConnection.

    • Description:

      Each API call will ask for credentials. This method will be used to test whether the credentials are correct. In our case, I make available only the following credentials:

    • Response:

      A reply in the JSON format containing the Success string if the credentials are correct and {"Error":"User or token is incorrect."} if the credentials are incorrect.

  • The getShippingCost...