What is PrestaShop?

PrestaShop is an e-commerce platform used worldwide for managing product listings, payments and orders. Users can build their modules or install existing ones directly within the administration panel. The great thing about the PrestaShop is that you can modify it in any way you want.

What are the features of the PrestaShop and why use it with 46elks?

First of all, PrestaShop is free to use and if you are familiar with CSS, PHP and HTML it will be a great fit for small and medium enterprises. Secondly, the PrestaShop has a strong user community which will make your daily operations easy to handle.

However, PrestaShop does not currently provide a free SMS module and therefore we've built one for you. With the 46elks SMS module you'll only pay the cost of each SMS you send, the module itself is free.

Using 46elks with PrestaShop will allow you to send notifications to your customers with ease. Let's show you how to get started.

Getting started

To follow along this guide, ensure you have done the three steps below:

  1. Create a 46elks account.
  2. Allocate a virtual number with SMS capabilities.
  3. Get the source code.

File structure

After you have downloaded the source code you'll have a file structure looking like this on the first level:


      

As you can see, the root folder is called "send-sms-prestashop". It's important that the root folder and the PHP-file within the root folder has the same name. Therefore you'll have to rename the root folder to "elks".

Now your file structure should now look like this:


      

You'll find more about the file structure in the PrestaShop documentation.

Set your API credentials

To be able to send SMS we need to update the API-credentials in the code.

  1. Open the file /elks/controllers/admin/elksadmin.php.

  2. Change the username and password to your own API credentials:

    
              

  3. Save the file.

Upload the module

Now we are going to upload our module to the PrestaShop to activate it.

  1. Archive (zip) the elks folder with your changes and name the file elks.zip.

  2. Go to your PrestaShop and navigate to "Modules" -> "Modules Manager" in the left sidebar:

    Illustrating the sidebar in which you should select the option 'modules manager'.
  3. In the modules manager click the button "Upload module" in the top right corner of the page:

  4. Now when your module is uploaded, you'll find the 46Elks Admin page on the left side of the panel. The admin page will show you information about your first order (e.g. name, email or phone number).

Now your module is up and running.

How to send a notification to the customer?

Sending a notification to the customer is easy. Fill your SMS content and click on the "Send" button. The information will then be sent to the phone number specified in the order.

Short description of the code

Let's shortly explain the code in the controller file.

As you can see in the code example below we are setting the order ID value into 1. This means that we want to get information about the first order on your PrestaShop.

You probably want to change this to a dynamic value to be able to get information about any order.


      

In the "Validate order object" section we are checking if your order exists in your webshop. Once we have checked if the order is valid, we'll set the variables which we want to display later in the template file.


      

In the "template file" section we are loading the view which is the representation of the order that will be displayed in the admin panel.


      

Before you send SMS to your customer, you probably want to change the text sender ID (the name or number that is displayed when receiving a text from someone). You can set this value up to 11 alphanumeric characters. In the example below it's set to "PHPElk".


      

You can find more information about PrestaShop API on the following link https://devdocs.prestashop.com/1.7/webservice/

Be creative

PrestaShop API is allowing you to use the order dates however you want. You have a choice to send SMS to different numbers, create an SMS marketing campaign, send notifications with details about the products and orders, and send a newsletter. It's a great tool for marketing and advertising.

Just be creative and innovative. Best of luck!

Do you want help?

Please contact our support. We love talking to our users.