Skip to main content
11 Sep 2013

Magento is a feature-rich eCommerce platform built on open-source technology that provides online merchants with unprecedented flexibility and control over the look & feel, content and functionality for their eCommerce store.

SugarCRM empowers organizations to gain and retain customers by providing greater efficiency and control over their sales pipeline. As an open-platform web-based CRM solution, Sugar is easily customizable to meet an organization’s changing needs. It is easy-to-use and offers a competitive advantage by providing organizations with a 360-degree view of their customers.

 

Why integrating SugarCRM with Magento makes sense?

For any e-Commerce store, continuous analysis of customer behavior and enhancing buyer experience are vital to turn more browsers in to buyers.

The rightly managed customer relationships can help companies to integrate sales, marketing and customer service business functions in order to maximize the value out of each customer interaction. Magento has a number of features that can help to manage customers, but by no means is Magento a fully-fledged Customer Relationship Management system. This is where Magento and CRM integration adds values for online store.

SugarCRM integration into Magneto platform allows companies to monitor customer’s behavior not only by products purchased, but also increase repeat purchases, brand loyalty and conversion rates, social media engagements in an integrated database.

How to integrate Magento with SugarCRM ?

Following are the typical business requirements to be considered

  1. Create new/ update existing lead in SugarCRM when customer registers on the Magento based web-store.
  2. Convert Lead to Opportunity in SugarCRM when the registered customer adds a product to shopping cart on Magento based web-store.
  3. Add/Update Contact in SugarCRM by taking the latest customer details from Magento based web-store whenever a Lead has been converted to an Opportunity.
  4. Finally, immediately log the order details in SugarCRM when the customer places an order on Magento based web-store.

In this article, you will find how to create Lead and Opportunity into SugarCRM based on buyer actions on Magento based web-store.

System Requirements for Integration

  • Magento (Any Edition)
  • SugarCRM 6.5.8 Edition
  • PHP-SOAP library
  • Netbeans IDE or Eclipse IDE
  • MySQL 5.1.x (Any MySQL Version)
  • Apache 2.2.x (Any Apache Version)

4 Steps to integrate SugarCRM with Magento

Step 1: Creating Web Service User in Magento

In order to provide SugarCRM an access to inbuilt Magento web-services, one needs to create user and assign role from Magento Admin. Login as Magento Admin and perform following steps,

  1. Create User: Navigate to System → Web Services → SOAP/XML-RPC – Users.
     
  2. Define Role: Navigate to System → Web Services → SOAP/XML-RPC – Roles.
     
  3. Assign Role: Navigate to System → Web Services → SOAP/XML-RPC – Users and assign the User Role which we have defined above to the Web Service User.
     

Step 2: Creating Web Services users in SugarCRM

In order to provide Magento an access to Web Services of SugarCRM, we need to create a new user and assign roles from SugarCRM Admin. With these user credentials, we can get a session in SugarCRM and we can use this session to perform all the service related operations in SugarCRM.

  1. Before creating a new User you need to go to Password management page to disable the Auto generated password function, so that the user is allowed to enter its own password. For this, navigate to Password Management page under Admin → Disable the tab as shown below.
     
  2. Create a new User: Navigate to SugarCRM Admin page → User Management → create New User.
     

Step 3: Creating Lead in SugarCRM when customer registers on Magento website

In order to manage and monitor leads in SugarCRM, we need to log them immediately when a new user registers at Magento site. To performing this operation, you need to

  1. First of all, we need to override this controller, create a custom module and then add following code in config.xml file of your custom module under global section as shown below –
  2. Change the AccountController.php file available under -Magento_dir(root)/app/code/core/Mage/Customer/controllers/AccountController.php
     
  3. Include the core AccountController.php file in custom module for overriding it.
     
  4. Open the core AccountController.php file and one can see all the customer related functions. Check for “createPostAction()” Function. This function is called, when a customer click on register button after providing the details under the New Account Registration page of Magento.
  5. When this function is called, one must write the code block to call SugarCRM services and create a new Lead by passing the customer related information from Magento to SugarCRM. For this, a session can be created under SugarCRM by calling the Login Soap method as given below.
     

In the above code, the “$options” array contains information related to soap file location and uri. Further, the “$user_auth” array contains user authentication details such username, password and SugarCRM version. Next, one needs “session_id” for accessing 3rd party applications by using SOAP protocol. Lastly, the “$response” array for setting an entry under Lead module in SugarCRM containing “name” and “value” pair. “Name” contains field name of table and “value” contains the customer related information to be added to table.

Step 4: Create an Opportunity in SugarCRM when customer add any product in his/her cart on Magento store.

Whenever a registered user at Magento site adds some product to cart, it will be considered as an opportunity for business.  In this step one will learn about how to log opportunity in to  SugarCRM.

To perform this operation, one needs to do following:

  1. Change the CartController.php file available under -Magento_dir(root)/app/code/core/Mage/Checkout/controllers/CartController.php
  2. To override this controller, create a custom module and then add this code in config.xml file of your custom module under global section as shown below –
     
  3. Next, we need to include the core CartController.php file in our custom module to override it.
     
  4. Open the core CartController.php file and you can see all the customer related functions. Check for “addAction()” Function. This function will be called, when a registered customer click on “Add to Cart” button after selecting the desired product from Magento.
  5. When this function is called, we must write the code block to call SugarCRM services and create a new Opportunity by passing the product related information from Magento to SugarCRM.
  6. A session can be created under SugarCRM by calling the Login Soap method as given below -
     

In the above code, the “$options” array contains information related to soap file location and uri. Further, the “$user_auth” array contains user authentication details such username, password and SugarCRM version. Next, one needs “session_id” for accessing 3rd party applications by using SOAP protocol. Lastly, the “$response” array for setting an entry under Opportunity module in SugarCRM containing “name” and “value” pair. “Name” contains field name of table and “value” contains the product related information to be added to table.

Benefits of Integration

This article shows how to generate lead and opportunity in SugarCRM based on buyer actions on Magento based web-store. With more customization, one can realize following benefits from Magento-SugarCRM integration.

  • Track buyers and improve conversions rate
  • Real-time product promotions to web-store visitors
  • Understand consumer behavior by analyzing popular searches, tags & ratings, most viewed products, most viewed pages, most selling products and many more consumer insights
  • Target right audience for email marketing and promotional campaigns
  • Understand market, forecast buying patterns and propose discounts or assistance for right products and services.

In summary – it is all about customer relationship and managing it effectively with the use of technologies.