Module ECommerce NG (Magento)

Informations

Module name Ecommerce NG (Magento)
Editor / Editeur Teclib - www.teclib.com
Download or buy page / Page achat ou téléchargement www.dolistore.com
Status / Statut / Estado Development / Développement
Prerequisites / Prérequis Dolibarr min version 3.9.0+

Prerequisite of Magento: Magento version 1.9.* - 1Gb of allowed memory on the PHP where Magento run may be required   

Last update date / Date mise à jour fiche / Fecha última actualización 2022-10-17
Note / Nota


Features

Integrates a synchronization between Dolibarr and an eCommerce platform. Support for Magento is stable and experimental for WooCommerce. Support for Prestashop is still in development (contributions are welcome).

It is a module to be installed in Dolibarr. Access to the eCommerce platform is done by Dolibarr using default WebServices provided by the eCommerce solution.

NOTE: This module is using the same core as Module ECommerce NG (Woocommerce) EN.

Installation

Magento

We suppose you have a Magento already available. If not, this is quick steps to install it:

  • Go on www.magento.com to download last version.
  • Unzip package on a magento root directory
  • Create an empty database on your mysql/mariadb server
  • Create a virtual host on your apache server to point to this magento directory and call this url. Use external url for your localhost. A wizard will start to initialize Magento. Note: If you need to work locally only, with an internal URL, you must known than with magento < 2, the name of the virtual host can't be "localhost". But you can edit your /etc/hosts file to add an entry like magento.local or localhost.localdomain on ip 127.0.0.1 and use this (this suppose you want to work locally only).

Note 1: The URL for administration backoffice may be /index.php/admin or /index.php/administrator or /index.php/admin_xxxxx (where xxxxx is a number)

Note 2: To reset password of an admin user: UPDATE admin_user SET password = MD5('NEWPASSWORD') WHERE username = 'admin';

Note 3: config files of Magento are stored into app/etc

Dolibarr module

From the application

  • Download the archive file of module (.zip file)
  • Go on menu Home -> Setup -> Modules -> Deploy external module and submit the file.
  • Module is then visible into list of available modules (Home -> Setup -> Modules) and can be activated.

Manually

  • Download the archive file of module (.zip file)
  • Put the file into the root directory of Dolibarr.
  • Uncompress the archive file, for example with command
unzip modulefile.zip
  • Module is then visible into list of available modules (Home -> Setup -> Modules) and can be activated.

Setup

To use this module, you must first enable it using an administrator account, via the menu option "Home - Setup - Modules".

Choose the tab where the module is listed. Then click on "Activate".

The module is now activated.

If a cog icon appears   on module thumb or at end of the line of the module, click on it to access the setup page specific to the module.

Setup on Magento side

  • Create first a Webservice SOAP/XML RPC role from admin interface System - Webservices - SOAP/XML RPC Roles, for example role soaprole. Grant this role Access to *All resources*.
  • Create a Webservice SOAP/XML RPC account from admin interface System - Webservices - SOAP/XML RPC User, for example account soapuser. Remember the password you used into field API key during user creation. Set this user to the role you created at previous step. Note: A user with no role set is useless and Dolibarr won't be able to login with it.
  • The parameter System - Configuration - Services - Magento Core API - WS/I Compliant can be set to true or false.
  • Note: If you create a product, to have it visible on Magento shop, check that qty in stock is higher than zero, that status "Stock Availability" is set to "In stock" and that product is inside a category of the site.
  • Note: With Magento, the stock of a product decrease on Magento side as soon as an order is done on Magento shop.

Setup on Dolibarr side

Aller sur la page de configuration Dolibarr du module Magento.

 

  • Saisir l'URL des services SOAP Magento.
  • Renseigner le login et l'API key créé à l'étape précédente dans Magento (soapuser).
  • Choisir la catégorie à utiliser pour marquer les tiers issus de Magento ou ceux à pousser sur Magento. Le tiers assigné à cette catégorie seront poussés en temps réel sur Magento.
  • Choisir la catégorie mère dans laquelle sera créée les catégories produits issues de Magento. Les produits créés ou modifiés qui sont assignés à une catégorie ou sous-catégorie de cette dernière seront poussés sur Magento en temps réel.
  • Stock synchronisation direction: Option Stock synchronisation direction: Mettre le sens de la synchronisation du stock.
  • Warehouse for stock initialization: Enter here the warehouse that will be used for any stock init/change when a product is created into Dolibarr because a new product (with a stock not empty) is found on eCommerce shop. This parameter is not used if previous option Stock synchronisation direction is set to None or dolibarr2ecommerce.

Usage

Synchronize from Magento to Dolibarr

Before doing your first synchronization, you must check this:

  • Be sure to not having too much categories on Magento side (< 1000)
  • If you already have thirdparties on Dolibarr side, check that reference of thirdparties are same than name on your ecommerce. If not, the synch won't be able to detect a record already exists and it will recreate another thirdparty on Dolibarr side. For contact/addresses, check is done on all fields "firstname + lastname + address + zip + town".


Synchronizing can be done manually from page Synchronizing Site ...:

Action into Magento Effect into Dolibarr When Note
Categories created/modified into Magento Created into Dolibarr as sub-categories of the parent category used for Mangeto categories (defined into module setup) Manual click on "Magento to Dolibarr sync" button
Available
Table llx_ecommerce_category is updated to store a link between dolibarr category id and remote magento id. Due to a lack of search on last modified time on Magento API, this sync may be slow if you have a high number of categories
Products or Stock created/modified into Magento Created into Dolibarr and linked to its categories.
If module stock is enabled and Stock synchronisation direction was set to "ecommerce2dolibarr", stock is also initialised/updated into warehouse defined into eCommerce dolibarr module setup
Manual click on "Magento to Dolibarr sync" button
Available
Table llx_ecommerce_product is updated to store a link between dolibarr product id and remote magento id
Thirdparties and contact/addresses created/modified into Magento Created into Dolibarr Manual click on "Magento to Dolibarr sync" button
Available
Table llx_ecommerce_societe and llx_ecommerce_socpeople is updated to store a link between dolibarr thirdparty id and remote magento id. To know if a thirdparty already exists, Magento check on the ref. To know if a contact already exists, Magento check on all fields firstname, lastname, address, zip, town (and thirdparty).
Orders created/modified into Magento Created into Dolibarr Manual click on "Magento to Dolibarr sync" button
Available
Table llx_ecommerce_commande is updated to store link of dolibarr order id and remote magento id
Shipment created/modified in Magento Creating a shipment in Magento is changing Magento status of the Order from "pending" to "processing". Because it is changing status of order, see case "Order created/modified into Magento". Manual click on "Magento to Dolibarr sync" button
Available
Note: The shipment is not downloaded into Dolibarr, only status of Dolibarr Order will be changed like is the Magento order.
Note: You may choose to manage shipment on Dolibarr or Magento (we recommand to create/update shipments on Dolibarr and not into Magento).
Invoices created/modified into Magento Created into Dolibarr (with correct status but without payments) Manual click on "Magento to Dolibarr sync" button
Available
Table llx_ecommerce_facture is updated to store a link between dolibarr invoice id and remote magento id.


In recent version of module, the "Magento to Dolibarr sync" button can be completed with a scheduled job/script that can launch the synch automaticaly every hour for example.

Synchronize from Dolibarr to Magento

Synchronizing is done in real time.

Action into Dolibarr Effect into Magento When Note
Categories created into Dolibarr No update is currently done on Magento. In a future version, creation will be done into Magento if category is inside the parent category for Magento, defined into module setup No creation/update is currently done on Magento. In a future version, sync will be in real time
TODO
Categories modified into Dolibarr No update is currently done on Magento. In a future version, update will be done into Magento if category is linked to Magento (category was created by a "Magento to Dolibarr sync") No creation/update is currently done on Magento. In a future version, sync will be in real time
TODO
Products created into Dolibarr None. In a future, creation will be done into Magento if product has a category inside tree of Magento categories No creation is currently done on Magento. In a future version, sync will be in real time
TODO
Products or Stock modified into Dolibarr Update into Magento is done if product is linked to Magento (product was created by a "Magento to Dolibarr sync")
If module stock is enabled and Stock synchronisation direction was set to "dolibarr2ecommerce", then stock is also overwritten on Magento
Real time
Available
Thirdparties created None. In a future version, creation will be done into Magento if thirdparty has the category of Magento thirdparties (defined into setup) No creation is currently done on Magento. In a future version, sync will be in real time
TODO
Thirdparties modified into Dolibarr Update into Magento is done if thirdparty is linked to Magento (thirdparty was created by a "Magento to Dolibarr sync") Real time
Available
Contact/addresses created into Dolibarr None. In a future version, creation will be done into Magento if thirdparty has the category of Magento thirdparties (defined into setup) No creation is currently done on Magento. In a future version, sync will be in real time
TODO
Contact/addresses modified into Dolibarr Update into Magento is done if contact/address is linked to Magento (contact/address was created by a "Magento to Dolibarr sync") Real time
Available
Orders created (validated) into Dolibarr None Orders created directly into backoffice does not need to appear into ecommerce. See next line for Orders modified.
Orders modified into Dolibarr Order will be updated into Magento if order is linked to Magento (order was created by a "Magento to Dolibarr sync") No update is currently done on Magento. In a future version, sync will be in real time
TODO
Shipments created (validated) into Dolibarr Shipment will be created/modified into Magento if source order of shipment was created by a "Magento to Dolibarr sync" Real time
Available
Shipments modified (closed) into Dolibarr This step does not exists on Mangento, so nothing is done NA
Invoice created (validated) into Dolibarr None. In a future, invoice will be created/modified into Magento if source order was coming from Magento No creation/update is currently done on Magento. In a future version, sync will be in real time
TODO
Invoice modified into Dolibarr (for exemple when status change to paid because of a payment entered) None. In a future, invoice will be created/modified into Magento if source order was coming from Magento No creation/update is currently done on Magento. In a future version, sync will be in real time
TODO Priority 1
Stock of a product modified into Dolibarr (whatever is reason: shipment processed, order or invoice validated, depending on your Dolibarr setup of the stock change rule, manuel change of stock or inventory) Stock is updated on Magento if product exists also in Magento and if synch direction was set to "Dolibarr2Ecommerce" Real time
Available

Development

Development of this module is not included into standard GIT repository of Dolibarr but inside a dedicated repository managed by TecLib.

Please submit your PR to this repository if you make enhancements to this module.

TroubleShooting

Due to a problem in Magento, if you have a large number of product categories, you may experience low performance when counting data to synchronize and when making a synchronize. This is how you can fix this:

On Magento 1.9 side, edit the file app/code/core/Mage/Catalog/Model/Category/Api.php to add the line that is under the comment /* FIX */

    ...

    /**
     * Convert node to array
     *
     * @param Varien_Data_Tree_Node $node
     * @return array
     */
    protected function _nodeToArray(Varien_Data_Tree_Node $node)
    {
        // Only basic category data
        $result = array();
        $result['category_id'] = $node->getId();
        $result['parent_id']   = $node->getParentId();
        $result['name']        = $node->getName();
        $result['is_active']   = $node->getIsActive();
        $result['position']    = $node->getPosition();
        $result['level']       = $node->getLevel();
	
	/* FIX Add here this new line to add the missing property returned by web service */
	$result['updated_at']  = $node->getUpdatedAt();

        $result['children']    = array();
		
        foreach ($node->getChildren() as $child) {
            $result['children'][] = $this->_nodeToArray($child);
        }

        return $result;
    }

    ...