cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Creating categories, products using impex script?

former_member1354369
Participant
0 Likes
4,431

Hello Hybris Experts,

Am karthik new to Hybris product level.

Could you please advise me how to create new categories and add products into it using impex script.

Many Thanks in Advance

BR R venkata karthik

Accepted Solutions (0)

Answers (2)

Answers (2)

Hey Karthik,

this will create your categories:

 $baseStoreCountry=baseStoreName
 $productCatalog=ProductCatalog
 $catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
 
 
 INSERT_UPDATE Category;code[unique=true];name[lang=de];name[lang=en];$catalogVersion
 ;"category-code";"Kategorie Name DE";"Category Name EN";

This will allow you to sort these categories in a hirarchy:

 $baseStoreCountry=baseStore
 $productCatalog=$baseStoreCountry-ProductCatalog
 $catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
 $supercategories=source(code, $catalogVersion)[unique=true]
 $categories=target(code, $catalogVersion)[unique=true]
 
 INSERT_UPDATE CategoryCategoryRelation;$categories;$supercategories
 ;"child-category-code";"parent-category-code"

And this will associate the products with the category:

 $baseStoreCountry=baseStore
 $productCatalog=$baseStoreCountry-ProductCatalog
 $catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
 $supercategories=supercategories(code, $catalogVersion)
 $baseProduct=baseProduct(code,$catalogVersion)
 $approved=approvalstatus(code)[default='approved']
 
 
 UPDATE Product;code[unique=true];$supercategories
 ;116029;category-code
0 Likes

Can I ask you how many category items will the following ImpEx create?

$prodCat=electronicsProductCatalog

$version=Staged

$catVersion=catalogVersion(catalog(id[default=$prodCat]), version[default=$version])

INSERT_UPDATE Category; code[unique=true];$catVersion[unique=true]

;test_category;electronicsProductCatalog

;test_category,apparelProductCatalog:$version

;test_category;:Online

;test_category;

Former Member
0 Likes

Hi Karthik,

All the examples you need can be found in "/hybris/bin/ext-template/yacceleratorinitialdata/resources/yacceleratorinitialdata/import/sampledata/productCatalogs/catalogName"