Sample: Loading image attachments for categories and catalog entries
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.
Before you begin
- 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
- Create the managed files with the fileloader utility.
- Create the managed files with the Management Center Assets tool. When you are creating these files, create the files within the Attachment folder in the Assets tool.
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
- Open the command-line interface and go to the following directory:
- WC_installdir/bin
- WCDE_installdir\bin
- Enter the following command:
- ./dataload.sh ../samples/DataLoad/Catalog/Attachment/wc-dataload.xml
- dataload.bat ..\samples\DataLoad\Catalog\Attachment\wc-dataload.xml
- dataload ..\samples\DataLoad\Catalog\Attachment\wc-dataload.xml
The command performs the following steps:- Loads catalog groups from the CatalogGroup.csv file.
- Loads catalog entries from CatalogEntries.csv file.
- If necessary, loads the data to create the attachments in the CatalogGroupAttachment.csv file.
- Loads the catalog group to attachment relationship from the CatalogGroupAttachment.csv file.
- If necessary, loads the data to create the attachments in the CatalogEntryAttachment.csv file.
- 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:
- WC_installdir/samples/DataLoad/Catalog/Attachment/CleanUp.sql
- WC_installdir\samples\DataLoad\Catalog\Attachment\CleanUp.sql
- WCDE_installdir\samples\DataLoad\Catalog\Attachment\CleanUp.sql
- To remove the attachments, see Deleting attachments.
- To remove the files, see Deleting managed files.