Prestashop plugin V2

This handbook explains you how to define parameters for the Prestashop 2.1. plugin.

If you already have a prior version, we advise you to update it to take benefit of all the features described below.

1. Installation of Prestashop V2 module

1.1 Compatibility of the module

The module is compatible:

  • from the version 1.4.4.1 of Prestashop
  • with 2.x versions of the Mondial Relay plugin only

Warning: Some functionalities of this module are incompatible with versions of Prestashop between 1.5.2 and 1.5.4. *. If you have one of these versions, update your version of Prestashop to take advantage of this module. Otherwise, it is vital that you enable the "Limit to one order per import" option.

1.2 Download the module

Before the installation / update of the plugin, follow our tips!

Download the module on our website: https://www.lengow.com/integrations/prestashop/

1.3 Installing the module on your Prestashop site

After you have downloaded the module, go to the administration panel of your Prestashop site:

  • Tab "Modules"
  • Click "Add a new module"

  • Select the downloaded archive file and then validate
  • Then click on the "Install" button

2. Configuring the module

To access the module’s configuration, click on "Configure".  

2.1 Account

Once your Lengow account is open, enter this three identifiers:

If your Lengow account is still not open, this step is not required to export your product catalogue. This step is vital for you to capture orders and import them onto your Prestashop site.

  • Customer ID

Enter the customer ID that was sent to you from your Lengow account manager. You can also find it by going to the Lengow menu > tab "see your account details" > id XXXX

  • Group ID

Enter your Lengow group or groups ID.
To find your Lengow group identifier, go to the Lengow menu > tab "see your account details" > click on "Group Management".


 
If, as in our above example, you have several groups, separate these identifiers with commas (example: 11095,11099,12167,12169)

  • API Token

Enter your API Token.
To find your API Token, go to Lengow and use the "API/WebServices" > link (at the bottom of the page) > tab "Token" > "Token API": https://solution.lengow.com/api/

  • Enter your IP address on the Lengow site

You have to fill in the IP address of the servers using the webservices on the Lengow site. This is a safety feature that enables you to restrict access to our services to authorised users. To do this, all you need to do is to go to the Lengow site and use the "API/WebServices">Link then the > tab "Token" > "API Token". In the field Allow the following IP, you can add the IP address(es) which are likely to be interested by Lengow webservices. Each IP must be separated by a ‘;' (semicolon) without a space. Once you have entered your address, click Save. 

2.2 Security

  • Authorised IP

This field enables you to allow certain IPs to access your export data, i.e. the URL for your source stream.

2.3 Tracking

The Prestashop module enables you to add a Lengow tracker directly to your site.
 
You have the choice between two types of tracker:

  • SimpleTag: This is the standard Lengow tracker; it lets you track sales in your Lengrow account interface.
  • TagCapsule: Tagcapsule consolidates a set of Lengow tracker partners within a single, unique tag by choosing those that you want. It lets you track sales in your Lengrow account interface.
  • Item Identifier for the Tag: This field enables you to choose the item ID to use in the tag’s display.

3. Export catalogue

The export script enables Lengow to retrieve your catalogue using different formats (csv, xml, json and yaml). This is then loaded into your Lengow account. It is this export file which will serve as a "source stream". It will be used as the basis for managing your different information flows via Lengow. This export will be indexed in Lengow as frequently as you choose.

3.1 Selection of items

You can select items from your catalogue that you want to export. To do this, go to the "Catalogue" >tab "Lengow".

3.1.1 Multiple Selections

If you want to post or remove several items at once, select the required items, then in Grouped Actions, click Post on Lengow / Remove from Lengow.

3.1.2 Selecting item by item

To post/remove an item from the selection, click the Lengow Status icon corresponding to the item required. The page will refresh and the status change automatically.

3.2 Export Settings

We offer you a number of options so that you can configure your catalogue’s export settings in the best way possible. Here are descriptions for each of them:

  • Default export carrier :

This option allows to define a carrier for the shipping fees calculation. The list that is proposed is based on carriers that are defined into your Prestashop back office.

  • Export only selection :

If this option is activated, you only export the Lengow selected articles. If the option is de-activated, all of your catalogue will be exported. 

  • Export disabled products:

If this option is enabled, all your items are exported, regardless of their status on your Prestashop site (active or inactive).

  • Auto export of new products:

If this option is enabled, new items are automatically added to your export stream.

  • Export product variations:

If this option is enabled, you export both parent and child items. This option is useful if you want to send your catalogue to the marketplaces or Google Shopping.

  • Titles + attributes + features:

If this option is enabled, the headings for your child items appear in the form: Heading + attributes + characteristics. For example, a T-Shirt with the name "Faded, short-sleeved T-shirt", with this option enabled, the heading for a child item will look something like: “Faded, short-sleeved T-shirt - Colour - Orange, Size - S". Conversely, if the option is not enabled then the item’s name will be simply “Faded, short-sleeved T-shirt".
For your information, an attribute is used to define the child item. It can also have an effect on the item’s price and it is selectable. A characteristic is simple technical information about an item.

  • Export out of stock products:

If this option is enabled, your out of stock items are exported. If you sell on the marketplaces, we recommend that you enable this option. In fact, most marketplaces require that you keep items with a unit quantity of 0 in your stream for a short time, and correctly remove the item later.

  • Image type to export:

This option allows you to choose the size of the images that you want to export with your catalogue.

  • Number of images to export :

This option allows you to choose the number of images that you want to export.

  • Export default format :

This option allows you to choose the export format for your catalogue. You have the choice between xml, json, csv and yaml. To use this export as a source stream for Lengow, we recommend that you use csv format

  • Export in a file:

This option is useful when your catalogue contains a large number of items (+ 3000) or when your catalogue stream takes a long time to generate. With this option your catalogue stream is stored in a file located in the folder /export of your Lengow module. Lengow then directly retrieves this file to index your catalogue.
Caution: If you use a file, it is important to request a Cron job to keep your file updated.

  • Export fields:

This option allows you to choose the fields of the items that you want to export. To do this, select the fields from the list displayed. If you want to select multiple fields, hold down the "Ctrl" key on your keyboard.

  • Export product features:

When the Export child items option is not enabled, the items’ characteristics (defined on your Prestashop site) are not exported. By activating this option, the characteristics are exported in separate fields.

  • Export features:

This option allows you to choose product features that you want to export. To do so, select your fields among the list. If you want to select different fields, press "Ctrl" on your keyboard.

  • Your export script:

Here is the URL to launch your export script. It follows the pattern: www.your-prestashop-shop.com/modules/lengow/webservice/export.php
This URL will serve as a "source stream" for Lengow.

4. Importing orders

The orders import process allows you to create the orders in your Prestashop back office. By doing this you can manage orders directly from your Prestashop site without having to go through your Lengow account. Before launching an import it is therefore important to adjust the following settings.
Default options are already selected. They are the options users choose most frequently. You are free to modify these options according to your needs.

Note: It is mandatory to fill in your Lengow Identifier (part "2.1 Account") to import your orders.

4.1 Status Management

The Lengow module lets you match order statuses on the marketplaces with those made available by Prestashop using a status match. Matching is done using the following three options: 

  • Status of process orders
  • Status of shipped orders
  • Status of cancelled orders

It is vital to adjust these three parameters because that lets the Lengow module automatically update orders on the marketplaces and on Lengow.

4.2 Order Logistics 

  • Associated payment Method:

The 'Payment Method' option enables you to customise the payment type displayed. There should be no question of creating another payment when the orders are imported because they have already been settled on the marketplace. The Lengow module therefore installs a dummy payment module. This option displays the name of the 'Lengow' payment module or the name of the marketplace the order comes from, on completion.

  • Default carrier:Irt

This option enables you to assign a default transporter for the order. The list offered is based on the transporters configured in your Prestashop back office.

4.3 Other import settings

  • Import from X days :

This option enables you to set the period for which you want to import your orders. So, if you want to import your orders from the last 5 days, you just enter the number "5".  Orders already imported are stored in your database. This avoids orders being imported several times.

  • Force products:

This option allows you to force order imports even if the items are out of stock or inactive. If one of the items ordered is not available and this option is not enabled, then the order is not created.

  • Import processing fee:

If this option is enabled, the costs associated with the marketplaces (commissions) are included in the order. This gives you better accounting management.

  • Fictitious emails:

If this option is enabled, the customers’ accounts created at the time of order import will all have a dummy email address allocated based on the order number. The advantage of this option is that customers who order from the marketplaces already have an account on your Prestashop site. In effect, if the same customer orders from your Prestashop site, then he would receive a message telling him that an account already exists.

  • Marketplace shipping method:

This option allows you to retrieve the transporter selected by the customer on the marketplace. If the transporter is not available on your Prestashop site, then the transport which has been chosen the most is selected.

  • Import orders shipped by marketplaces :

If this option is activated, orders shipped by marketplaces will be imported into the back office. Products from the order will not be removed from the stock of the shop. By default, orders shipped by marketplaces are not imported.

  • Status of orders shipped by marketplaces :

This option allows you to select the default status for orders shipped by marketplaces. 

  • Report email:

If this option is enabled, you will receive an email report for each import. This email tells you if there were errors during the orders import.

  • Limit to one order per import process:

This option means that you can limit the order’s creation per import launched. This option was developed with the aim of resolving the incompatibility with versions of Prestashop between 1.5.2 and 1.5.4. By activating this option you will not create duplicate orders.

  • Import state and script:

The status tells you if an import is in progress or not.

The import script follows the pattern of the URL displayed. If you go to this URL then the order import process will be launched. The URL follows the pattern: www.your-prestashop-shop.com/modules/lengow/webservice/import.php

5. Order logs

Logs are important, they let you know if the order import has completed without any problems. The module includes an interface that tells you if an order has imported correctly or if an error occurred when it was being imported. To see the log this go to Catalogue > Logs import Lengow. You will then be able to search by order (according to the marketplace ID) and see any message corresponding to that order.

If there is a mistake in an order which has been corrected, you will need to delete the message before the order is imported. Actually the import does not return a value for orders with a registered log on the database. This saves time on imports.

6. Other parameters for developers

These last points are aimed at developers:

  • Debug Mode: this mode means that you can test using the Lengow module. When it is enabled, it allows you to import orders under a dummy Lengow order ID. Nothing is activated in Lengow for the imported orders in debug mode. Caution: If this mode is enabled, then the orders can import several times. It is therefore important only to activate it in a test environment.
  • Export Timeout: this option is useful when you are exporting to a file. It allows you to cut the export stream generation into several cycles with a duration fixed by the value that you specify in this field. This means that you to avoid server timeout errors
  • Logs: all the module’s actions are logged in the files listed here. The log files have a 5 day lifespan.

7. CRON Jobs

Cron is a tool that allows you to run certain tasks automatically. 

7.2 Creating a cron job on your server (recommanded)

The creation of a cron job on your server must be performed by a technician or a developer. There are two advantages of using a cron job directly on your server:

  • It give you better customisation of task run frequency 
  • It enables you to create multiple export files depending on the required parameters. In effect, by default, when you save your export to a file, it is automatically overwritten. This can be annoying if you want to have multiple streams with different settings for each (see below).  Using a cron task server enables you to be able to circumvent this problem thanks to the wget command. For example:
* 0 0 */4 * * wget http://monsite.web/modules/lengow/webservice/export.php

7.1 Creating a cron job using Prestashop’s Cron job editor 

Since version 1.6, Prestashop has integrated a cron job manager (called Cron job editor) within its modules. We are therefore going to talk a little in this documentation the module for creating cron jobs.

To add a cron job, install the Cron job editor module.

Then, go in the Lengow module > "Configure" > "Cron set up" > enable "Use Cron tasks manager module"

8. Parameter Overload

It is possible to add parameters (GET) to the export and import URL and so overload the module’s configuration.

8.1 Export Settings

Among the export settings:

  • format: export format (csv, json, xml, yaml)
  • mode: export all items & child items (full) or without the child items (simple)
  • stream: rendering stream (1) or write to a file (0)
  • shop: retailers ID if there are multiple retailers
  • cur: currency in ISO format
  • lang: language in ISO format
  • ids: to only export specified items (IDs separated by commas)
  • active: "enabled" for the active items, "all" for all items
  • limit: You can limit your export to a number of items
  • out_stock: Export the out of stock items (1)

For example: www.your-prestashop-shop.com/modules/lengow/webservice/export.php?format=csv&limit=15&out_stock=1

8.2 Import Settings

Within the import parameters:

  • limit : you can limit the number of orders to import
  • days : to change the period from which you want to import orders
  • shop : the retailer’s id (in the case of a multiple retailers)
  • lengow_debug : to import orders in debug mode

For example: www. your-prestashop-shop.com/modules/lengow/webservice/import.php?limit=15&days=5

In the latest versions of the Lengow module for Prestashop (from the 2.0.7), you can import a particular order. To do this you have to enter the stream id and the id of the GET order parameter (idflux and idorder) of the import URL. For example: www.your-prestashop-shop.com/modules/lengow/webservice/import.php?idFlux=1234&idOrder=123456ABC

9. Updating the module

The update procedure is identical to installing the module.

10. View your Lengow statistics

A feature has been added to enable you to view your main indicator statistics on your Prestashop site (only accessible for Prestashop versions above 1.5)
There is now a dedicated sidebar on Prestashop’s homepage.
You can also view your clicks, sales, ROI, etc.

You can also have a stream inventory with the number of items they contain

11. Migration from the old to the new Lengow module

11.1 Migration from the source stream in Lengow

Warning: These options are to use with caution.
Make sure that the source stream you will use contains the same information as the current source stream (the same flow structure (headers), export of simple items or child items etc.)

If you have any doubts don't hesitate to contact Lengow’s support desk.

If you click "Migrate this stream", the URL of your source stream, taken into account by Lengow, will be amended.

If you click "Migrate all streams", your entire source stream will be modified in Lengow.

11.2 Order Import

The 2 Lengow module versions can cohabit at the time of migration. However, be careful as there is a risk of importing duplicate orders onto your Prestashop site.
To avoid this, you can uncheck the checkbox "Use Prestashop’s webservice to import orders" from your Prestashop import management page.
This check box is unchecked by default when we detect that the Lengow module V2 has been installed on your Prestashop site.

12. F. A. Q

  • I don’t have any orders in Prestashop administration 

Verify that you have entered your site’s IP address at this URL: https://solution.lengow.com/api/

  • I have errors while installing the plugin

Check whether the so called "cURL" library is well installed on your server (Be careful! The use of this library is only for people with advanced computer skills).