Samples > Data load utility samples


Sample: Changing the parent of a subcategory

This sample demonstrates how to use the CatalogGroupRelationshipMediator data load mediator to move a subcategory from one parent to another.


About this sample

In this sample, the mediator deletes the parent relationship between the "Women's fashions" top category and "Accessories" subcategory. In the same operation, the mediator creates a new parent relationship, making "Accessories" a subcategory of the "Men's fashions" top category.


Procedure

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

  2. Enter the following command:

    • ./dataload.sh ../samples/DataLoad/Catalog/ChangeParent/wc-dataload.xml

    • dataload ..\samples\DataLoad\Catalog\ChangeParent\wc-dataload.xml


Verify results

The wc-dataload.xml configuration file first calls the wc-loader-catalog-group.xml configuration file to load all sample categories from the CatalogGroups.csv source file in parent directory. Next the wc-dataload.xml file calls the wc-loader-catalog-group-relationship.xml configuration file to change the parent of category "Accessory" from "Women's Fashions" to "Men's Fashions" using the ChangeCatalogGroupParent.csv source file.

Verify that the parent category has been changed by running the following SQL statements:

You can also verify the load by viewing the categories in the Management Center or in the storefront.


Clean up the data

To remove the data loaded in this sample from the database, run the CleanUp.sql file in the /samples/DataLoad/Catalog/ChangeParent directory.


Previous topic: Sample: Loading classic attributes, attribute values, and allowed values


Next topic: Sample: Loading category descriptions in multiple languages

Related reference

Data load utility samples


+

Search Tips   |   Advanced Search