sap-commerce-cloudimpex

Remove Multiple Categories from Product In HYbris Using Impex


How multiple categories can be removed and added to a product using impex in HYbris in a single row Something like:

REMOVE CategoryProductRelation;target[unique=true](code,$catalogVersion);source[unique=true](code,$catalogVersion)

;xyz;cat1,cat2,cat3

Solution

  • You may also try :

    $ProductCatalogVersion=catalogVersion(catalog(id[default='$catalogID']),version[default='$catalogVersionID_STAGED'])[unique=true,default='$catalogID:$catalogVersionID_STAGED']
    $CategoryCatalogVersion=catalogVersion(catalog(id[default='$catalogID']),version[default='$catalogVersionID_STAGED'])[unique=true,default='$catalogID:$catalogVersionID_STAGED']
    
    $superCategories=supercategories(code,$CategoryCatalogVersion)
    
    
    INSERT_UPDATE Product;$ProductCatalogVersion;code[unique=true];$superCategories[mode = remove]
    ;;xyz;cat1,cat2,cat3
    

    Hope this helps