Tested environment :
Talend ESB v6.1.0
Magento version : v1 , SOAP API version : v1
SugarCRM Version : 184.108.40.206 , SOAP API version : v2.
Magento v1 Both community and EnterPrise Edition.
$allCustomerIds = $soap->call($sessionID,"advanceapi_customer.getAllIds");
//Write your code here!
Our Customized API will give us All CustomerIds list only , Where as basic magento API which will fetch customer details with basic information along with Customer Information (like customerid, name,email etc…)
$allCustomers = $soap->call($sessionID,"advanceapi_customer.itemslist",array($allCustomerIds));
This Customized Api will give us Complete information about the customer ids we are passing to this method which includes customer information and customer Addresses.
Where as in basic Magento needs to send request every time to get customer information and one more request for customer Address.
1. Login to Magento admin Panel
2. Go to System -> Magento Connect -> Magento Connect Manager
3. Login into Magento Connect Manager
4. Upload the provided Folder (i.e app) and Click on Upload.
5. After Successful installation goto System-> Cache Management in admin and Flush all Caches.
Talend Job Implementations :
JobName : Magento2SugarCRMSync .
This job sync Customers from Magento to SugarCRM using Custom magento plugin . Fetches all Customers data like firstName , lastname , email , telephone , city , postcode etc and validates it later syncs to SugarCRM with WebService .
Job Responsibilities :
1. Loads Magento and SugarCRM configurations through property file .
2. Fetches the Customers IDs list using Custom Magento API , Iterates Over IDs and get the Customer data along with address data .
3. Using Magento Custom Plugin ,we are getting Customer address data in batch that decreases number of requests on server also load on server .
4. Iterating Over batch of customers data, validating the data then Mapping to SugarCRM fields that syncs to SugarCRM .
5. Before inserting the Customer’s to SugarCRM , we are checking whether this Magento Customer is already existing or not in SugarCRM using contacts . assigned_user_id .
6. We are Inserting Magento Customer to SugarCRM if the Magento Customer does not exists in SugarCRM .
7. Trigger E-mails when Exceptions encountered in jobs Also after completion of Customers sync with Sync details .
Components used in this job:
1. tFileInputProperties : For fetching the Magento and SugarCRM configurations from property file .
2. tContextLoad : for loading the property files variables to Job .
3. tWebserviceInput : for fetching the customer data from Magento instance .
4. tLoop: for iterating over customer data got from Magento Response .
5. tSugarCRMInput : for checking the existence of magento customer in SugarCRM.
6. tSugarCRMOutput : for syncing the magento customers to SugarCRM .
7. tjava : for writing java custom code for validating magento customer data.
8. tjavarow : for reading the data from Input/Output components in job .
9. tMap : for mapping Magento customer variables to SugarCRM fields for syncing customers to SugarCRM.
10. tLogCatcher : for catching the exceptions logs in job.
11. tSendMail : for triggering mail in job whenever respective conditions are met .
Job Description :
Part -1 :
In Figure-1, we are checking Property file existence then loading Magento and sugarCRM configurations in to talend job . This gives us the flexibility of dynamic changing the configurations in job . Later validating the configuration values.
Figure -1 :
Part -2 :
In Figure-2, shows the main part of the job which fetches Customer IDs using Custom Magento Plugin API then process then in batch wise to SOAP API for getting customer data .
Each Batch of Customer data is processed further for extracting customer fields like firstName , lastname , email , telephone , city , postcode .
Extracted data is validated then synced to SugarCRM by mapping magento variables to SugarCRM Fields .
Here before syncing we are checking whether magento Customer exists or not in sugarCRM . If not then only syncing magento customer to SugarCRM using SugarCRM SOAP API .
Part -3 :
In Figure – 3 , Triggering Sync e-Mails in talend jobs after completion of sync process with sync details like Total Customer count , synced customers count, sync performed time etc .
Also triggering exception e-Mail when ever exceptions are encountered in job with details like Exception Message , Exception occurred time etc .
How to execute the Job Manually on Command Line :
Go the job directory and execute the .sh file i.e Magento2SugarCRMSync_run.sh as shown below :
./Magento2SugarCRMSync_run.sh –context_param PropertyFilePath=’/Plugin.properties’ -context_param MagentoConnectionTimeOut= 240 -context_param MagentoReadTimeout=360000
PropertyFilePath = Property file path
MagentoReadTimeout= (360000) .
MagentoConnectionTimeOut= (240) .
####Property file configuration #####
#### SMTP Configurations ######
Example cron scheduling for every 5 mins :
*/5 * * * * . $HOME/.bashrc; /bin/sh /home/ktree/Talend_jobs/MagentoSugarCRM/MagentoSugarCRM20160509/Magento2SugarCRMSync/Magento2SugarCRMSync_run.sh –context_param PropertyFilePath=’/home/ktree/Talend_jobs/MagentoSugarCRM/Plugin.properties’ –context_param MagentoConnectionTimeOut=240 –context_param MagentoReadTimeout=360000 >> /tmp/MagentoSugarCRM.log 2>&1