Sample: Replacing existing products and SKUs
This sample demonstrates how to use the data load replace mode by replacing products and SKUs previously loaded to the database.
About this sample
This sample replaces the list price and name of the product and SKU listed in the following table:Names and list prices of catalog entries before and after running this sample
Part Number Old Name Old List Price New Name New List Price Cords Men's corduroy pants 30 Men's designer corduroy pants 35 Cords-Black-29W x 28L Men's corduroy pants - Black 29W x 28L 30 Men's designer corduroy pants - Black 29W x 28L 35
Procedure
Before running this sample, ensure that you have loaded the initial data.
(Developer) On a command line, go to the WCDE_installdir\bin directory.
- (Linux) Open a command line in the Utility server Docker container. Change the directory to utilities_root/bin directory.
For information about entering and leaving containers, see Running utilities from the Utility server Docker container.- Enter the following command:
- (Linux) ./dataload.sh ../samples/DataLoad/Catalog/IntegrateScenario/wc-dataload-replace-product-item.xml
(Developer) dataload ..\samples\DataLoad\Catalog\IntegrateScenario\wc-dataload-replace-product-item.xml
Verifying results
The wc-dataload-replace-product-item.xml configuration file replaces the product and SKU data loaded in the initial load sample with data in the CatalogEntries.csv source file. Verify that the data is replaced by running the following SQL statement:select catentry_id, name from catentdesc where catentry_id in (select catentry_id from catentry where partnumber like '%Cords%') select * from listprice where catentry_id in (select catentry_id from catentry where partnumber like '%Cords%')This statement returns the names and list prices of the product and SKU being replaced by the data load.
We can also verify the load by viewing the updated list price and name in the Management Center or in the storefront.
Cleaning up the data
To remove the data loaded in this sample from the database, run the CleanUp.sql file in the /samples/DataLoad/Catalog/IntegrateScenario directory.Note: After running the CleanUp.sql file, we might see that 0 rows are deleted for certain SQL statements. This result is expected, as not all rows are populated with data in this sample.