Documentation Home

Broadleaf Importer

This module provides the ability to bulk import data into Broadleaf. This currently supports the following bulk import use cases:

  • Catalog data (Products, Skus, Categories)
  • Assets (.zip file of media items)
  • Customers and Addresses
  • Orders

Import Specification

The new Importer module works off a concept called a Specification. See Import Specification

Supported files

CSV and Excel files are supported for the importing.

Installation

If your project uses the Parent Starter (BOM) configuration, only the following entry needs to be added to the "core" project pom.xml"

<dependency>
    <groupId>com.broadleafcommerce</groupId>
    <artifactId>broadleaf-importer</artifactId>
</dependency>

If the Parent Start (BOM) is not being used, then the following steps need to be done to include the Import module into your project:

  1. Add the following to your property section of your parent pom.xml

        <broadleaf-importer.version>2.1.0-GA</broadleaf-importer.version>
    
  2. Then in the dependency management section of your parent pom.xml, add:

        <dependency>
            <groupId>com.broadleafcommerce</groupId>
            <artifactId>broadleaf-importer</artifactId>
            <version>${broadleaf-importer.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
    
  3. Add the following to the dependency management section of your admin pom.xml:

        <dependency>
            <groupId>com.broadleafcommerce</groupId>
            <artifactId>broadleaf-importer</artifactId>
        </dependency>
    
  4. One additional table is needed for asset imports. Here is the table schema for MySQL. Change as needed for your database of choice:

        CREATE TABLE `blc_media_import_info` (
          `MEDIA_IMPORT_ID` bigint(20) NOT NULL,
          `ADMIN_USER_ID` bigint(20) DEFAULT NULL,
          `CATALOG_DISC` bigint(20) DEFAULT NULL,
          `CORRELATION_ID` varchar(255) DEFAULT NULL,
          `CREATED` datetime DEFAULT NULL,
          `ENTITY_ID` bigint(20) DEFAULT NULL,
          `ENTITY_TYPE` varchar(255) DEFAULT NULL,
          `EXISTING_MAP_ID` bigint(20) DEFAULT NULL,
          `EXISTING_MEDIA_ID` bigint(20) DEFAULT NULL,
          `IMPORT_TO_SANDBOX` bit(1) DEFAULT NULL,
          `IS_STARTED` bit(1) DEFAULT NULL,
          `MEDIA_KEY` varchar(255) DEFAULT NULL,
          `MEDIA_URL` varchar(255) DEFAULT NULL,
          `SITE_ID` bigint(20) DEFAULT NULL,
          `TARGET_SANDBOX_ID` bigint(20) DEFAULT NULL,
          `UPDATED` datetime DEFAULT NULL,
          `VERSION` bigint(20) DEFAULT NULL,
          PRIMARY KEY (`MEDIA_IMPORT_ID`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
  5. Finally, to process the imported images, the following job should be created:

        INSERT INTO blc_sched_job (SCHED_JOB_ID, ARCHIVED, CRON_EXPRESSION,ADMIN_ADDITION_STATUS, ENABLED, EXECUTED, MANAGE_IN_ADMIN, NAME, TARGET_DATE, TYPE, DATE_UPDATED) 
        VALUES (10, null, '0 0/1 * ? * * *', null, 1, 0, null, 'Import image processor', null, 'IMPORT_IMAGE', now());
    

    Adjust the Primary key value of 10 if needed. By default the job is running once a minute, change the cron expression according to your needs.

Version Compatibility

Import Version Broadleaf Core Version
1.2.x-GA 5.2.16-GA+
2.0.x-GA 6.0.9-GA+
2.1.x-GA 6.1.x-GA+
2.3.x-GA 6.2.x-GA+

Module Dependencies

Functional Dependencies

This module requires the Simple transition. Make sure to add the tables and enable the property as described in the link.

Optional Dependencies

UI changes

There are a few additional buttons that have been added to key pieces of the application. For instance, when you go to the
'Product' or 'Category' sections, there is a new button in the UI to 'Import Products (Importer)' or 'Import Categories (Importer)'.