Opentaps Magento Integration

From Opentaps Wiki
Revision as of 17:44, 16 January 2010 by Michele.orru (talk | contribs) (Opentaps/Magento Mappings explanation)
Jump to navigationJump to search

This module is now ready for beta testing by developers. If you are interested, please contact Open Source Strategies to request access to the Subversion repository.

Introduction

This integration allows you to use the Magento e-commerce system with opentaps Open Source ERP + CRM. The integration is designed to allow you to set up your products and catalogs in Magento, take orders using the Magento online store or using the Magento order entry module, and then import the products and orders to opentaps for purchasing, manufacturing fulfillment, and invoicing.

Specific features supported are:

  • One way push from Magento of newly added products and sales orders (Changes to products and orders are currently not handled.)
  • All Magento orders added to one "Magento Customer" in opentaps
  • Payments received in Magento are imported into opentaps under "Magento customer" an associated with the corresponding order
  • Once orders are shipped in opentaps, the tracking number is sent back to Magento and associate it with the original order.
  • Only one magento product store is supported at any time.

This integration is compatible with the free Magento Community Edition.

Installation

The opentaps-Magento integration requires one module for Magento and two components for opentaps:

  • IntegratingWeb module for Magento
  • Data Access Layer (DAL) and magento-integration components for opentaps

The Magento module retrieves product and order data from Magento and serves them up via the REST protocol. The DAL component for opentaps receives the data from the Magento module and stores them in the opentaps database, and the magento-integration component uses the opentaps data import component to import the products and orders.

Installing the Source Version from Subversion

You can install the source code version from subversion by checking out the IntegratingWeb module for Magento and the Data Access Layer (dal) and magento integration modules for opentaps.

Installing the Magento Extension

1. Checkout the IntegratingWeb Magento module in $magentoInstallationPath/app/code/local

  svn co svn://svn.opentaps.org/opentaps_magento/magento_component/versions/1.0/trunk/OpentapsIntegration OpentapsIntegration 

After the download, the Magento directory structure must look like the following:

  $magentoInstallationPath/app/code/local/OpentapsIntegration

2. Move $magentoInstallationPath/app/code/local/OpentapsIntegration/Restful/etc/OpentapsIntegration_Restful.xml in $magentoInstallationPath/app/etc/modules:

  mv $magentoInstallationPath/app/code/local/OpentapsIntegration/Restful/etc/OpentapsIntegration_Restful.xml $magentoInstallationPath/app/etc/modules

3. Go on the Magento backend in System->Configuration, then Advanced->Advanced .

4. Click on "SAVE CONFIG", in a way that the Magento configuration files will be reloaded.

5. If you click on "Disable modules output", you should see a module named OpentapsIntegration_Restful: if that is your case, then you have succesfully installed the Magento module.

Installing the opentaps Modules

First, go to the hot-deploy/ subdirectory for opentaps: opentaps $ cd hot-deploy

Then, checkout the Data Access Layer (DAL) and magento-integration modules: hot-deploy $ svn co svn://svn.opentaps.org/opentaps_magento/opentaps_component/versions/1.4/trunk/dal dal hot-deploy $ and svn co svn://svn.opentaps.org/opentaps_magento/opentaps_component/versions/1.4/trunk/magento-integration magento-integration

After the download, the opentaps directory structure must look like the following:

$opentapsInstallationPath/hot-deploy/dal
$ opentapsInstallationPath/hot-deploy/magento-integration

Finally, modify the file $opentapsInstallationPath/hot-deploy/component-load.xml uncomment the following two lines:

  <load-component component-location="dal"/>
  <load-component component-location="magento-integration"/>

The Opentaps modules are now installed. Now restart opentaps, and go to http://localhost:8080/magento-integration/control/main to ensure that the modules are loaded.

Configuring the opentaps Magento Integration

First you need a user which has access to magento data. You can create this user from the Magento backend:

  1. In the Magento backend, go to System-> Web Service -> Users, and add a new user.
  2. Then go to System-> Web Service -> Roles and create a new Role with "Resource Access" set to "All".
  3. Finally, associate the user with that role.

Next, $opentapsInstallationPath/hot-deploy/magento-integration/config/magento-integration.properties:

  1. Set the URL and administrative access user and password for opentaps
  2. Set the URL and resource access user and password for magento
  3. Set paging size, which is the number of products retrieved in each batch from magento
  4. Set the magento store ID, which is the field store_id of the table core_store of the Magento DB


NOTE: when you modify any .properties file in Opentaps, you must reboot your instance because properties are loaded statically at boot application time.


Opentaps/Magento Mappings explanation

The magento-integration Opentaps module have a directory named "mappings" that contains a CSV file for every Magento workflow/area currently supported by the integration. These CSV files are processed by the transformations, and used when storing data in Opentaps.

storeMappings.csv: handles the mapping between the Magento stores IDs and the Opentaps ProductStore/RootCategory entities.

   MagentoStoreId,OpentapsRootCategoryId,OpentapsStoreId
   1,MPSCATALOG1,mag1

The ProductCategory and ProductStore definitions can be found in magento-integration/data: by default XML files there are loaded as demo data. Informations about the Magento storeIDs can be found in the core_store table.


shippingMappings.csv: handles the mapping between the Magento shipping methods and the Opentaps shipping methods

  magentoShippingMethodId,opentapsShippingMethodId
  fedex_FEDEXGROUND,9015
  ups_GND,9001
  fedex_FEDEX2DAY,9002

The Opentaps shipping method IDs are defined as seed data, and are common of every Opentaps installation. Th Magento shipping methods can be found in the core_config_data table: by default Magento append the carrier code (ex.: UPS) to the shipping method (ex.: GND, states for Ground), thus resulting in a shippingMethodId of ups_GND.