Schogini - Amazon AWS, Magento and Mobile Developers
 

Magento Enterprise Edition Automated Bulk Remote Product Import Using XML/SOAP

Magento Commerce is the leading provider of open omnichannel innovation. Its an open source, cloud-based digital commerce platform and omnichannel solutions empowers merchants to integrate digital and physical shopping experiences. Built for rapid innovation, the platform combines rich, out-of-the-box functionality with powerful business tools. This customizable platform seamlessly integrates with third-party solutions, can be deployed in any environment, and is backed by a vast network of commerce experts ready to help you.

3rd party systems can invoke Magento actions using XML/SOAP protocol. This advanced features allows Magento inventory & orders to be managed remotely. Hence, allowing Magento to be a part of large ERP / CRM systems.

Objective:

The client needed to automatically add products & attributes to the Magento store remotely from their existing inventory system. The products can be either simple or configurable and the attributes, values and attribute sets needed to be created in the correct order to allow this.

Schogini’s Role:

Develop a system that will parse data from the client’s existing inventory system, format it and make the necessary Magento SOAP calls to add it to the Magento shop. Duplicates in attributes, values & products must be avoided.

Schogini’s Solution:

Instead of manipulating the database directly, Schogini decided to go with the SOAP method so that the system is safe from Magento upgrades. Updates made to the database during Magento upgrade will not affect this system since, it will use the Magento classes to import the data. As long as the API parameters remain the same, the system will work.

The first step was to setup a Magento SOAP user account with permissions to manage every area of the Catalog, including inventory. Next, a PHP CLI script was developed which reads the CSV/Excel file from a folder, parses its content and segregates the attributes, attribute values, attribute sets, simple products, configurable products & associated products. The CSV/Excel file is exported from the inventory system into the folder. To prevent API timeout, a bash script is used to invoke the PHP script which will import the data in chunks. Data is imported in this order:

  • Attributes
  • Attribute Sets
  • Attribute Values
  • Simple Products
  • Configurable Products

Issues Faced:

  • A major issue was product images. At the moment, the Magento API doesn’t have a call for remote upload of product images. As a work around, Schogini created a system on the Magento shop server which will import the media files from the remote server and then, call the necessary Magento classes to connect them to the correct products. This script was developed using bash & PHP to ensure optimal usage of server resources, prevent timeout issues and also ensure that Magento framework is used to connect the images so that the files are stored in the correct location & the appropriate tables are updated safely.
  • The second issue was preventing duplicate product images. In case the import system had to run again, the script had to ensure that duplicate product images are not imported. An algorithm was prepared using the data parsed from the CSV and the data from the Magento database to prevent this.

Client Benefit:

The most important benefit for the client was that the data could be imported directly from the inventory system. Their team was free from formatting the data for Magento - the system took care of this automatically. Of course, other than data formatting, the team was also free from the actual data import which the developed system took care of, ensuring no duplicates.

Author

Gayatri S Ajith - CEO/Cloud & DevOps Architect
Gayatri is a certified professional and highly experienced OpenSource eCommerce developer, team lead, and project manager. She is Magento Certified Developer Plus and Magento Certified Solutions Specialist. With over a decade of hands-on development experience in web technologies (LAMP & MEAN), she has a strong technical background with the ability to communicate those technicalities frequently and clearly. Gayatri is comfortable in proposing alternatives when necessary to ensure the client goals are met - always. Currently, she is mastering AngularJS & Ionic while heading the eCommerce division of Schogini.
Know more about the author.
 
 
 

CONTACT US

We love to talk to you, all enquires are replied to in under 4 hours.