0

I'm trying to create multiple subcategories to a supercategory with one line in impex file. Something like this:

INSERT_UPDATE Category;code[unique=true];categories(code, $productCV);$productCV
;001;001001,001002,001003

The code above is not working. I want 001 to be a supercategory for 001001, 001002, 001003

I can do this in 3 lines for example:

INSERT_UPDATE Category;code[unique=true];$supercategories[default='catalog'];$productCV
;001001;001
;001002;001
;001003;001

Just wondering is it possible to do it with one line? Couldn't find a qualifier to do this.

Thanks!

2 Answers2

0

You can use below template for this.

$catalog-id=myProductCatalog
$catalog-version=Online

$catalogversion=catalogversion(catalog(id),version)[unique=true,default=$catalog-id:$catalog-version]
$supercategories=supercategories(code,catalogversion(catalog(id[default=$catalog-id]),version[default=$catalog-version]))

$categories=categories(code,catalogversion(catalog(id[default=$catalog-id]),version[default=$catalog-version]))

INSERT_UPDATE Category;code[unique=true];$categories;$catalogversion
;001;001001,001002,001003;
mkysoft
  • 5,392
  • 1
  • 21
  • 30
  • This is the same code as mine I showed above, it is not working, it returns the following error: INSERT_UPDATE Category;code[unique=true];categories(code,catalogversion(catalog(id[default=ProductCatalog]),version[default=Staged]));catalogversion(catalog(id),version)[unique=true,default=ProductCatalog:Staged] ,8796109668494,,,column 2: cannot resolve value '001001,001002,001003' for attribute 'categories';003;001001,001002,001003; – Nikolay Mihaylov Nov 20 '17 at 15:19
  • 3
    You need to create subcategories before assign. – mkysoft Nov 20 '17 at 19:31
  • Oh.. thank you very much. I thought I created those categories, but there was no 001003, my mistake. :) – Nikolay Mihaylov Nov 21 '17 at 09:00
0

It's not possible to create more than one item per impex line.

You cannot create MORE THAN ONE categories in one line.

With your first impex statement you create a category with the code 001 and the existing categories referenced by the codes 001001, 001002 and 001003 (and of course catalogversion). Keep in mind, that you can only reference existing categories. Only when the categories with the codes 001001, 001002 and 001003 exist, your statement will succeed.

You can only create ONE category in one line.

In your second example there are 3 lines which create the categories 001001, 001002 and 001003 and assign the category 001 as a subcategory. There has to be an existing category with the code 001 (and catalogversion). Only in that case, this statement will succeed.

Johannes von Zmuda
  • 1,814
  • 8
  • 14