Using the DownloadPlus Import Adapter for mass importing of Serialnumbers

Requires the Import-Adapter for Serialnumbers for DownloadPlus

The import adapter for DownloadPlus for mass importing Serialnumbers from files is a add-on available here...



Installation of the import adapter for DownloadPlus is the same as for the DownloadPlus extension itself.

Update DownloadPlus to the most recent release prior to installation of this Add-On. Updates are available in your Customer Account.



The import adapter uses the Magento Dataflow Profiles for mass importing of serialnumbers.

Files being imported need to have the following data:

When importing Serialnumbers to Products

  • Product SKU
  • Serialnumber
  • Serialnumber Pool (optional)

When importing Serialnumbers to Global Pools

  • Serialnumber
  • Serialnumber Pool (optional, when not used set variable into_global to where to import the serialnumbers)



Create an Import Profile

In your Magneto Stores Administrator Backend go to System » Import/Export » Advanced Profiles and add a new Profile using Add new Profile:



Inside the Actions XML you need to define the dataflow for the mass import of serialnumbers. This configuration shown here is an example when using CSV-delimited text files with browser side upload of the file:

Action XML when using CSV files

<!-- This action loads the CSV file from the browser through upload -->
<action type="downloadplusimport/convert_adapter_http" method="load">
</action>
 
<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
    <var name="delimiter"><![CDATA[,]]></var>
    <var name="enclose"><![CDATA[]]></var>
    <var name="fieldnames">false</var>
    <var name="number_of_records">1</var>
 
    <!-- The field mapping to the import variables -->
    <var name="map">
        <map name="0">product_sku</map>
        <map name="1">serialnumber</map>
        <map name="2">serialpool</map>
    </var>
 
    <!-- Importing into a global serialnumber pool, or overriding the product serialnumber pool from the file -->
    <var name="into_global">false</var>
    <var name="into_pool">false</var>
 
    <!-- This is the DownloadPlus Import Adapter to use for this file import to create the serialnumbers from the file -->
    <var name="adapter">downloadplusimport/convert_adapter_serialnumbers</var>
</action>

Be aware the for large files the browser upload may fail, in that case upload the import file through file transfer to your server and use the server side file then for import. You need to define a different adapter for loading the file as described in the following.

Using server side files for import (instead of browser upload)

In case you want to use a server side file for import (either created automatically by your server or uploaded to your server through file transer), then use the this adapter to load a local file (replacing the browser upload adapter <action type=“downloadplusimport/convert_adapter_http” method=“load”> ):

Action XML

<!-- This action loads the CSV file from a server side path -->
<action type="dataflow/convert_adapter_io" method="load">
    <var name="type">file</var>
    <var name="path">var/import</var>
    <var name="filename"><![CDATA[serialnumbers-products.csv]]></var>
    <var name="format"><![CDATA[csv]]></var>
</action>
 
<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
...as in above example...
</action>

For your installation you may need to adapt the path where you will store the file to import server side, the filename you will use for the import file and the map for mapping the fields of the import file to the import variables product_sku (the Product SKU where the serialnumber belongs to), serialnumber (the serialnumber) and the optional serialpool when importing into Serialnumber Pools.

Upload path for the import files

With this configuration you need to upload the CSV-delimited file into var/import. To change the server-side directory to change the following to the path name of your choice:

<!-- This action loads the CSV file -->
<action type="dataflow/convert_adapter_io" method="load">
...
    <var name="path">...path for import file here...</var>
...
</action>



Filename of your import files

With this configuration the file name for importing from is set to serialnumbers-products.csv. To change this filename change the following to the filename used by you for the mass import file:

Action XML

<!-- This action loads the CSV file -->
<action type="dataflow/convert_adapter_io" method="load">
...
    <var name="filename"><![...your import files name here...]]></var>
...
</action>



Define your CSV-files structure

You need to define the structure of your CSV file for the import by defining the delimiter character, if the data values are enclosed by a character and if the first line of the file holds fieldnames:

Delimiter Character

Put the delimiter character used in your CSV file that delimited each individual field of a line into the Action XML:

<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
...
    <var name="delimiter"><![CDATA[...your delimiter character here...]]></var>
...
</action>


Fields enclosed by a character

If your field data is enclosed by a character, sometimes used is a hyphen like '“field”', then define this character here. When your file does not use such character use <![CDATA[]]> instead as an empty enclosing character:

<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
...
    <var name="enclose"><![CDATA[...your enclosing character here...]]></var>
...
</action>


Fieldnames in first row of imported file

Field mapping is done with mapping instructions. If your CSV file is having field names in the first line, please the fieldnames to true to prevent importing the first line then. If otherwise please set it to false to import the first line as direct data:

<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
...
    <var name="fieldnames">...</var>
...
</action>


Number of records imported at once

Per default the number of records imported at once is set to 1, if you want to increase this number set it here:

<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
...
    <var name="number_of_records">1</var>
...
</action>


Map the fields to serialnumber data

You need to tell the import adapter where to find the relevant import data in the single rows of the CSV file, this is done by mapping instructions that describe the relationship between the field index and the import variables product_sku, serialnumber and serialpool:

<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
...
    <var name="map">
        <map name="0">product_sku</map>
        <map name="1">serialnumber</map>
        <map name="2">serialpool</map>
    </var>
...
</action>


In above example first field (field index is 0, counting starts with zero) is the Product's SKU:

<map name="0">product_sku</map>


The second field (field index is 1) is the Serialnumber:

<map name="1">serialnumber</map>


The third field (field index is 2) is the Pool into which the Serialnumber belongs (if used for importing into a Serialnumber Pool):

<map name="2">serialpool</map>

If you do want to import a products serialnumber to the whole product (without a pool) then remove this field mapping.

Overriding Serialnumber Pool when importing serialnumbers for products

When importing serialnumbers to products, you may override any mapped serialpool data with setting the variable into_pool to the name of the products serialnumber pool to use:

<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
...
    <var name="into_pool">false</var>
...
</action>

If you do not need to override serialnumber pool data, then set the variable into_pool to false.

Importing Serialnumbers into Global Pools

When importing serialnumbers into a Global Pool remove the field mapping for product_sku and set the variable into_global to true:

<!-- This action parses the CSV file, maps the data and imports the serialnumbers -->
<action type="dataflow/convert_parser_csv" method="parse">
...
    <var name="into_global">false</var>
...
</action>

If your CSV file has a serialnumber pool field, map the field serialpool as described above and the serialnumber will be imported into the related Global Serialnumber Pool.
To override any serialnumber pool data contained in your CSV file, set the variable into_global to the name of the Global Pool you want the serialnumbers to get imported into.

To perform a mass import of serialnumbers from a CSV file upload the file to the path you defined in the Action XML and run the advanced profile. A new window will open, keep it open until the import is finished:



The import adapter does check if a serialnumber has been imported already into the store, so running the same import file multiple times will not create multiple entries for the same serialnumber.