Opentaps Magento Integration
- 1 Introduction
- 2 Installation
- 3 Configuring the opentaps Magento Integration
- 4 Opentaps/Magento Mappings explanation
- 5 Testing the Integration
- 6 How-To Implement Paypal Payments Pro into Magento - SANDBOX
- 7 Performance tuning
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.
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.
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:
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 (at the bottom of the left-hand side tabs for the System->Configuration screen.)
4. Click on "SAVE CONFIG" so that the Magento configuration files will be reloaded.
5. Now click on "Disable modules output", make sure you 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 $ 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:
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"/>
Go back to the opentaps directory and rebuild everything:
opentaps $ ./ant
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:
- In the Magento backend, go to System-> Web Service -> Users, and add a new user.
- Then go to System-> Web Service -> Roles and create a new Role with "Resource Access" set to "All".
- Finally, associate the user with that role.
- Set the URL and administrative access user and password for opentaps
- Set the base store URL and resource access user and password for magento. Test it by trying the URL plus /ws/orders/login For example, if your base store URL is http://www.my-magento-store.com/index.php, then you should see a page at http://www.my-magento-store.com/index.php/ws/orders/login The password is also the same as your magento user's API key.
- Set paging size, which is the number of products retrieved in each batch from magento
- 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.
Finally, use the opentaps Webtools > Entity XML Import to load the following files:
Opentaps/Magento Mappings explanation
The magento-integration Opentaps module has 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.
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. The 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.
paymentsMappings.csv: handles the mapping between Magento payment gateways and Opentaps payment methods.
The Opentaps payment method types and be found in the PaymentMethodType entity. The Magento payment methods can be found in the core_config_data table.
taxIdMappings.csv: handles the mapping between Magento tax codes and Opentaps tax authorities.
magentoTaxCode,opentapsTaxAuthPartyId US-CA-*-Rate 1,CA_BOE US-NY-*-Rate 1,NY_DTF
The Opentaps tax authorities can be found in the TaxAuthority entity (taxAuthPartyId field). The Magento tax codes, that needs to be defined for tax calculation, can be found in the tax_calculation_rate table.
Testing the Integration
Magento orders need to be in the "Processing" state to be imported into opentaps. This means that they must have payment received first. You can use the paypal developer sandbox to set up a dummy paypal account for payment processing. Alternatively, you can create your order with Check/Money Order and invoice the order, and then it will be "Processing."
How-To Implement Paypal Payments Pro into Magento - SANDBOX
You can follow the  to set up a developer account for payment processing.
When importing a large number of products/orders (order of thousands, we made some tests with more than 10.000 products) performance issues become important.
Default values of Opentaps 1.4 defined in startofbiz.sh work fine. Ensure that the Java Virtual Machine will be started with the following values
-Xms512M -Xmx1536M -XX:MaxPermSize=1024M
Note: in Unix systems the maximum number of open file descriptors is sometimes configured for a non-production system, that probably will not have high loads. In Linux based systems, this value is most of the time configured to 1024: the value can be verified with the following command:
To increase the default value, add a line such as the following in the file /etc/security/limits.conf
yourUser - nofile 10000
Finally, reboot your machine.
In $magentoInstallationPath/.htaccess memory used by PHP must be increased to a value of at least 512 Mb: this is a value you must tune based on the number of concurrent users that will access you production web site.
php_value memory_limit 512M