Samples > Data load utility samples


Sample: Adding image attachments to categories and catalog entries

This sample demonstrates how to associate attachments with categories and catalog entries.


About this sample

In this scenario, the following data is loaded:

The Data Load utility direct table load function is used to create the relationships between the categories, catalog entries and attachments usages.


Before you begin

Use the Management Center Assets tool to create managed files and attachments.

  1. Create managed files using these files in the samples directory.

    • 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 must copy the three .gif files on the server to your local machine. Verify the files are created in the store specified in the wc-dataload-env.xml file.

  2. Create attachments for the files you created in the previous step.

    Attachment identifier File
    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

The catalog groups and catalog entries loaded in this sample are associated with the attachments created in this step.


Procedure

  1. Open the command-line interface and navigate to the appropriate directory:

  2. Enter the following command:

    For a non-ATP store:

    • ./dataload.sh /usr/WebSphere/CommerceServer70/samples/DataLoad/Catalog/Attachment/wc-dataload.xml

    • dataload ../samples/DataLoad/Catalog/Attachment/wc-dataload.xml

    For an ATP store:

    • ./dataload.sh /usr/WebSphere/CommerceServer70/samples/DataLoad/Catalog/Attachment/wc-dataload-ATP.xml

    • dataload ../samples/DataLoad/Catalog/Attachment/wc-dataload-ATP.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. Loads the catalog group to attachment relationship from the CatalogGroupAttachment.csv file.

    4. Loads the catalog entry to attachment relationship from the CatalogEntryAttachment.csv file.

      In the configuration files: wc-loader-catalogGroupAttachment.xml or wc-loader-catalogEntryAttachment.xml, the line:

      <_config:Column name="ATCHRLUS_ID" value="1" valueFrom="Fixed" />
      

      specifies the attachment usage. An image attachment has a value of 1. You can change the value to specify a different usage, for example value="102" for a warranty document.)


Verify results

Verify that the data has been loaded by running the following SQL statement:

select * from catgroup where identifier in ('Mens Fashions','Womens Fashions','Pants','Shirts','Activewear','Accessory')
- This SQL returns all catalog groups loaded.

select * from catentry where partnumber like 'Cords%'
- This SQL returns all catalog entries loaded.

select * from atchrel where ATCHOBJTYP_ID=2 and atchtgt_id in (select atchtgt_id from atchtgt where identifier in ('Category Pants full image','Category Pants small image'))
- This SQL returns one catalog group to attachment relationships

select * from atchrel where ATCHOBJTYP_ID=3 and atchtgt_id in (select atchtgt_id from atchtgt where identifier in ('SKU Cords-Black-29W x 28L small image','SKU Cords-Brown-29W x 28L full image'))
- This SQL returns two catalog entry to attachment relationships

Verify in Catalogs Tool - You can open Catalog Tool in CMC and browse the categories and catalog entries created. You should be able to see the attachments you associated with the categories or catalog entries.

Verify in Store Front - You can go to store front to browse category and SKUs and we will be able to see the image attachment displayed in the store front.


Clean up the data


Previous topic: Sample: Loading category descriptions in multiple languages


Next topic: Sample: Loading sales catalogs


+

Search Tips   |   Advanced Search