Sample: Loading image attachments for categories and catalog entries

This sample demonstrates how to load attachments, specifically image attachments, and associate the attachments with categories and catalog entries for a non-ATP store.

About this sample

With this sample, the Data Load utility loads data to create the following objects:
  • Categories and relationships between categories and attachments. If necesary, the utility creates the attachments and attachment assets.
  • Catalog entries and relationships between the catalog entries and attachments. If necessary, the utility creates the attachments and attachment assets.
This sample loads the following types of input files:

Before you begin

Create the following managed files, which are needed by the attachments that you are associating with a catalog entry or category in this sample. The Data Load utility does not create managed files.
  • samples\DataLoad\Catalog\Attachment\mens_pants_dress.gif
  • samples\DataLoad\Catalog\Attachment\mens_pants_cords_sm.gif
  • samples\DataLoad\Catalog\Attachment\mens_pants_cords.gif
You can create these managed files by uploading the images in a compressed (.zip) file with the file loader utility or with the Management Center Assets tool:
Note: You must copy the three .gif files on the server to your local machine before you can upload these files.
If the attachments that are included in this sample do not exist in your environment, the utility creates the attachments and associates the appropriate assets to the attachments. You do not need to manually create the attachments and attachment assets before you run this sample. The utility uses the information with the CatalogEntryAsset.csv and CatalogGroupAsset.csv to create the attachments and attachment assets. Then, the utility associates the attachments with the catalog entries or categories. As part of loading this sample data, the utility can create the following attachments and attachment assets:
Attachment Attachment asset
Category Pants full image mens_pants_dress.gif
SKU Cords-Black-29W x 28L small image mens_pants_cords_sm.gif
SKU Cords-Brown-29W x 28L full image mens_pants_cords.gif

For more information about creating attachment assets, see Adding URLs to attachments.

For more information about the image requirements that you must follow to associate images with catalog objects in a store that is based on the Aurora starter store, see Catalog image requirements for the Aurora starter store.

Procedure

  1. Open the command-line interface and go to the following directory:
    • WC_installdir/bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  2. Enter the following command:
    • LinuxAIX./dataload.sh ../samples/DataLoad/Catalog/Attachment/wc-dataload.xml
    • Windowsdataload.bat ..\samples\DataLoad\Catalog\Attachment\wc-dataload.xml
    • WebSphere Commerce Developerdataload ..\samples\DataLoad\Catalog\Attachment\wc-dataload.xml
    The command performs the following steps:
    1. Loads catalog groups from the CatalogGroup.csv file.
    2. Loads catalog entries from CatalogEntries.csv file.
    3. If necessary, loads the data to create the attachments in the CatalogGroupAttachment.csv file.
    4. Loads the catalog group to attachment relationship from the CatalogGroupAttachment.csv file.
    5. If necessary, loads the data to create the attachments in the CatalogEntryAttachment.csv file.
    6. Loads the catalog entry to attachment relationship from the CatalogEntryAttachment.csv file.

Verifying results

Verify that the data is loaded by running the following SQL statements:
  • select * from catgroup where identifier in ('Mens Fashions','Womens Fashions','Pants','Shirts','Activewear', 'Accessory');

    This SQL statement returns all catalog groups that are loaded in this sample.

  • select * from catentry where partnumber like 'Cords%';

    This SQL statement returns all catalog entries that are loaded in this sample.

  • select * from atchrel where ATCHOBJTYP_ID=2 and atchtgt_id in (select atchtgt_id from atchtgt where identifier in ('/Aurora/Attachment/mens_pants_dress.gif'));

    This SQL statement returns one catalog group to attachment relationship.

  • select * from atchrel where ATCHOBJTYP_ID=3 and atchtgt_id in (select atchtgt_id from atchtgt where identifier in ('/Aurora/Attachment/mens_pants_cords_sm.gif'));

    This SQL statement returns two catalog entry to attachment relationships.

Verify that the relationships exist in the Catalogs tool. Open the Catalogs tool and browse the categories and catalog entries that are created in this sample. Ensure that you see the attachments that you associated with the categories or catalog entries.

Cleaning up the data

  • To delete the data that is loaded in this sample, run the following SQL file:
    • LinuxAIXWC_installdir/samples/DataLoad/Catalog/Attachment/CleanUp.sql
    • WindowsWC_installdir\samples\DataLoad\Catalog\Attachment\CleanUp.sql
    • WebSphere Commerce DeveloperWCDE_installdir\samples\DataLoad\Catalog\Attachment\CleanUp.sql
  • To remove the attachments, see Deleting attachments.
  • To remove the files, see Deleting managed files.