/SFCC-job_ImportProductsImagesFromFTP

This Salesforce Commerce Cloud cartridge provides Job For Importing Product Images from the FTP server, This repository contains a cartridge with Job Step, Job metadata, and Documentation.

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

SFCC-job_ImportProductsImagesFromFTP

visitor release commits since last commit code size in bytes

Introduction

This Salesforce Commerce Cloud cartridge provides Job For Importing Product Images from the FTP server, This repository contains a cartridge with Job Step, Job metadata, and Documentation.

Implementation Documentation

Pre Requests

cartradge: SalesforceCommerceCloud/job-components .

setup

  • Clone or Download Cartridges.
  • Add Both cartridges to your code version, upload them to the target instance.
  • Add cartridge to cartridge paths.
  • Import Job from mata folder.
  • Go to the Job Schedules tool in BM to verify FtpImportProductImages exist in jobs.
  • Configure, run the job.
  • Done!

Configuration

job configuration

downloadImagesFromFTP(custom.CSComponents.FtpUpload)::
  * ServiceID     # FTP/SFTP server endpoint and cridential must be configured in BM.
  * SourceFolder  # location in FTP server.
  * TargetFolder  # to download files to (default: "src/FtpImportProductImages/unassigned").
  * IsDisabled    # this step is disabled by default shoud be enabled to get files form FTP server.

generateXMLForImageImport(custom.custom.ImportProductImagesJob)::
  * catalogId      # FTP/SFTP server endpoint and cridential must be configured in BM.
  * workingFolder  # working folder for job relative to IMPEX (default: "/src/FtpImportProductImages/").

importImagesCatalog(ImportCatalog)::
  * workingFolder            # working folder for job relative to IMPEX/src (default: "FtpImportProductImages/xml").
  * ImportMode               # must be set to Merge
  * AfterImportFileHandling  # weather to keep files after import in xml folder of working folder.

After configuring job, in the {Working_folder} create this directory structure.

.
└──IMPEX
   └──src
      └──working folder # main working folder in IMPEX/src, required by job steps.
          └──unassigned  # contains folders that represent a catalog (data gets downloaded from FTP server using job step 1).
              ├──catalogId1   # catalog folder name as a valid catalog id contains folders representing products.
              │   ├──productId1    # product folder contains product Images.
              │   │   ├──productid1_large_P_01.jpg
              │   │   ├──productid1_P_02.jpg
              │   │   └──productid1_P_03.jpg
              │   └──productId2
              │       ├──productid2_large_P_01.jpg
              │       ├──productid2_small_P_02.jpg
              │       └──productid2_small_P_03.jpg
              └──catalogId2
                 ├──productId1
                 │   ├──productid1_large_P_01.jpg
                 │   ├──productid1_small_P_02.jpg
                 │   └──productid1_small_P_03.jpg
                 └──productId2
                     ├──productid2_large_P_01.jpg
                     ├──productid2_small_P_02.jpg
                     └──productid2_small_P_03.jpg

Image file name syntex.

  • attributes:

    Product ID: # Product ID of product.

    Image Position: # Position of image in view type/image group

    values: large,medium,small,thumb

    extention: # image file extention

    values: jpg, png

  • syntex:

    {productID}_{viewType}_P_{image position}.{extention}

  • example:

    productid1_large_P_01.jpg

    productid2_small_P_02.png

Technical Documentation

Job Configuration

  • context: Organization
  • JobStep 1: custom.CSComponents.FtpUpload from the job-components
  • JobStep 2: custom.custom.ImportProductImagesJob from job_ftp_import_products_images.
  • JobStep 3: ImportCatalog Standard import Catalog job step(ImportCatalog).

Flow

  • JobStep 1: Hendel's Downloads from FTP server.
  • JobStep 2: Hendel's XML generation for catalog image, and moves images files From {WorkingFolder/unassigned} folder to /CATALOG folder.
  • JobStep 3: Hendel's import of catalog XML generated by JobStep2.