Importing products with an XML file is one of the fastest and easiest ways to import a large catalogue of product content into your store. Often XML importing may be necessary if you are working with a partner/distributor who provides you with an XML structure directory. In this article, you will find information about what an XML structure is and how to use it to activate the application we have developed, to help you manage the product catalogue in your online store.
In this section:
- XML file structure
- Install the application
- Settings (1st step)
- Settings (2nd step)
- Settings (3rd Step)
- Additional Settings
XML file structure
The XML file must contain well-structured data. It contains tags that strongly resemble HTML tags. An XML document is actually a text file that contains various XML declarations and tags, as well as text. Here is an example of an XML document that contains information about multiple products:
In the photo above, you see tags that contain each item of the product summary information. Each element of a product, such as an identification code, name, category, description, tags, brand, price, weight, quantity, photo, variety, and value, must be enclosed with an opening and closing tag. The opening and closing tags must have the same name, the closing tag being preceded by a slash (/ "), in order for the information to be read correctly and to be imported to your store using the XML Import application. Between these two tags is the content, i.e. the data included in the relevant section.
There must be one basic element in which all the other elements are located. It's called Document Root. In the example, this is the <products> element. This opening main tag must have a closing one </products>. It contains many sub-tags, each of which has a closing tag and some information in between, for example: manufacturer tag <manufacturer> Manufacturer name </manufacturer>.
The names of the tags themselves, which contain each element, are arbitrary, not strictly defined, and are determined by the creator of the XML file. When imported, they will actually be linked to the already existing elements for a product.
A well-formed XML file conforms to a set of very strict rules that govern XML. If a file does not match them, the XML stops working. In the picture above you can see that each opening tag has a corresponding closing tag, this is one of the basic rules for well-formed XML. If you remove a tag and try to open this file, you will see an error message and the program will prevent you from using the file.
You don't have to know the rules for creating well-formed XML, but you should remember that you can share XML data between programs and systems only if the data is properly formed. If you cannot open an XML file, it is very likely that this file does not have the correct structure.
Here you can see the structure of a well-formed sample XML file.
Install the application
To use the XML Import application, you need to have such an XML file or feed (a file provided in the form of a link from which information is constantly drawn). Another option is to have another source of information (a spreadsheet in Google Sheets, for example) to convert to XML format. The information about a product in a table is usually contained on a single row, while in XML this information is on many rows that are enclosed in a single tag (for example, <product>). That is, the horizontal data visualization type is converted to vertical in the XML file.
1. Go to the admin panel of your store, section Settings > Files and click the Upload files button in the upper right corner of your screen to upload the xml file, if you have one. Then copy the link and paste it into the browser to make sure it works. If there is a problem with the file, a message will appear on the screen.
2. The next step is to go to the Apps> All Apps section and select XML Import and the Install button.
Settings (1st step)
1. Click the Create a job button to start a new job for import.
- Job name - enter a name that will identify the job. Subsequently, it will be used to identify each product - from which job it was imported. The job name will only be visible in the control panel. For example, if you are uploading products from a certain category (Headphones), this may be the title of the job.
- XML URL - In the XML URL Link field, paste the link (XML feed) that you have or that you copied after uploading the XML file in the Settings> Files section.
- Import all products in the category - use the drop-down menu to select an existing product category in which to import all products from this XML job. If the XML file contains product category information, you do not need to use this drop-down menu. If the XML feed you upload contains products from only one category, you can select it in the first step, if you have not selected such a category, the system will expect you to select a category for each product in the second step.
If you don't have categories created in your store, see how you can create them here.
- Import all products to the vendor - use the drop-down menu to select an existing brand into which all products from this XML job will be imported. If the XML file contains product brand information, you do not need to use this drop-down menu, just skip it and continue to the next step of the settings.
- Import all products as - from the drop-down menu, select whether the products should be imported as directly visible in your store or imported as unpublished. Once the entire job is completed and the products are imported, you can use the quick tools in the Products section to publish all the products at once.
- XML Product tag - a field in which you need to enter important information, namely the product tag. In the XML file, the opening and closing tags define the beginning and end of a product. In our case, this is the <product> tag. You need to enter the XML tag of the product from your XML file so that the parser (the script that reads XML files) can understand where a product starts and ends in the XML structure. This tag can be any, there is no set standard, so look at how it is named in your file.
For example:
The product tag contains all other tags and information for each product:
- Assign to the main XML job - The XML importer is fairly advanced software that can not only import but also update products. There can also be multiple sub-jobs that are attached to one main job. That is, if you have started one main job for importing products, you can run other sub-jobs to it, through which to fill your product catalog. This is a useful feature if all the products you want to upload are not in one file, but are divided into several. In this case, you can run several jobs to work as one and thus merge the entire product catalog.
- Rows - enter the maximum number of rows in the XML feed here for the system to check for a product tag. If the feed structure is correct, you should not need to change the number of lines and the product tag is sure to be included in the first 500 lines
- Disable missing products - very useful functionality when working with feeds, because they are constantly updated. If a product is out of stock or removed from the site of the distributor you work with, then this product will be automatically removed from your store when you update the feed.
- Track inventory - through this option the quantity of all products that will be imported will be monitored by the system. When an item is sold, the remaining quantity will be recalculated from the total set quantity of the product
- Continue selling - if you enable this option the system will allow ordering the product even if the quantity of the product is 0
- Task ID number - no matter what identifier you choose, it is important that it be unique to each job. If there are jobs with the same ID, the products are likely to conflict.
- Choose Fixed Discount type - through the XML importer it is possible to add product discounts, but for this purpose, your XML file must contain such a value (original price and sale price).
If you enable this option, you must create a discount from the Marketing > Discounts menu and select Fixed Discount. The XML Import application only works with this type of discount. Once you create the discount, it will be used for constant updating when the XML feed contains such information.
- Compare by - to prevent product duplication, you can compare products in the store with the ones you import by official ID, SKU or barcode. If a certain product already exists in the store, it will not be imported during the current task - it will only be updated if necessary.
- Action - you have the option to import and update the products or just update them. This means that the app also allows you to synchronize the products without importing new ones.
Settings (2nd step)
After checking the data entered in the first step, use the Save button and go to Step 2, where you will specify how to import the data from the XML feed into the product catalog of your store.
- XML Product ID - From the drop-down menu, select the product ID that meets this condition so that there are no products with the same SKU or ID, for example. On the right, in the drop-down menu, you will see the structure of your XML file. Choose the identifier for your products by which they differ from each other so that when updating the XML feed, it does not happen that two products that have, say, the same ID as the identifier, update in the same way.
- Title - select the tag that contains the name of each product in the file. It can be very different (name, product name, validation name, title, etc. in our sample file, this is the <title> tag.
- Short description - if you have such information in your file, select the appropriate tag. If you don't have one, you can skip this field.
- Description - the description of a product can be quite long and contain various signs, links, photos, etc. Select the appropriate tag that opens and closes the product description. In our file, this is the <description> tag
If there are photos in the description of a product, the "XML Import" software will extract them and upload and save them directly in the storage of your store, so that they become part of the description of the respective products.
When importing products, if the XML file contains tabs whose descriptions are a link to embed video from Youtube (link only), as here: <tabs> <tab> <name> Video </name> <description>https://www.youtube.com/embed/clJj2GUCic</description> </tab> </tabs> In this case, the link will be replaced with a code that will be able to directly display the video.
- SEO title and SEO meta description - you may not select them, they will be automatically created from the name and description of the product itself.
- Old URL address- serves when we migrate a store. If you set a value for the old URL of the product itself, the XML Importer will automatically create 301 links so as to preserve the positioning/indexing of the product. See more here.
- Price - select the tag for the original price (if you have one with a discount).
- Discounted price - choose a tag that matches the discounted price.
- SKU - select the tag that matches the SKU of the product
- Barcode - select the tag that matches the barcode of the product
- Quantity - select the tag that matches the quantity of the product
- Weight - If there is such information in your file, select the appropriate tag
- New - the products will be marked as new. This functionality is useful if you upload a file with new products only and want them to be marked as such.
If you want a row of the above to be constantly updated, you need to tick the rows you want, as shown in the photo above. However, keep in mind that the more rows you choose to update, the slower the import will be because many metrics of different products will be compared so that the software can update according to the specified criteria.
Description tabs
If you have several descriptions for one product in the feed, this functionality allows you to create several tabs with these descriptions, respectively. If you have only one description, you do not need to choose anything.
Category property
The structure of a property is the same as the product definition:
You have one summary tag for all properties. Each property has a name and a value. It must have a closing and opening tag. From the drop-down menu, select the corresponding tags.
- Property values can be several, but they can be separated by commas in the third step of the settings.
- Property value - most often accepts the value of the property, so you can select the same tag here.
In the next section, select the tag that applies to the Brand (Manufacturer).
Variants
To import product variants, your XML file must contain product variants groups. The same logic is followed for the variants as for the properties. Again, you need to carefully select the appropriate tags from your XML file.
Image manager
If you have multiple photos of a product in an XML file, they can be grouped under one tag and separated by commas. In the third step of the settings, you can create a rule in which the software, when it detects a comma, separates the individual elements and considers them as a separate things.
Settings (3rd Step)
In this step, you can create additional operations and rules for importing products from the XML file into your store directory. For example, if you want the contents of any of the tags to be supplemented or modified by certain values, you can set up all of these actions and change the product import as needed.
This setting is commonly used if you have a value in the XML feed, and you wish to upload it as a higher one in the product catalogue. You can create a variety of operations, depending on the contents of your file and the way you need to model it.
It is important to note that if you correctly specified the product tag in the first step of the XML upload, then in the next steps you will use the drop-down menus, through which the system will already successfully show you the information from the file and you just need to indicate what each tag from the XML feed should be used for.
Note that the way the text is written (lowercase / uppercase) in the field shown in the photo below must match the way it is written in the file, otherwise no match will be found and the operation will not be performed.
When you're done, save the job from the button in the upper right corner of the screen. The job becomes active, it is queued, when the time comes for its implementation it will start.
When you upload photos, they upload with a slight delay, as a group of clusters - servers, process each uploaded photo. The photos are optimized, the necessary filters are added to them, the quality is optimized so that they can be loaded and opened as quickly as possible on your site, so that they are of optimal quality.
Additional Settings
Once the task is started, it never stops, the next launches happen every 12 hours - XML importing starts to update the content if there is a change such as new products, availability, prices, etc.
You can increase the priority of your job, as well as shorten the implementation interval - instead of 12 hours you can make it run every 6 hours, for example.
From the XML Import Priority task button, you can purchase a priority for your job. That is, it will be completed by 20, 40, 60 or 80% before the other jobs.
From the other button XML Import interval you can change the interval for starting the given task.