On the fly category creator/importer

From Magmi Wiki
Jump to navigation Jump to search

Using this plugin supersedes the category_ids column

This plugin enable to define the category tree levels where the item should be put. The full category tree will be created on the fly, even if categories are missing or still existing.

Column name

the column name for defining category tree levels is categories

Parameters

The plugin defines the following optional column:

  • base category tree

This enable to prepend a defined tree level to all category tree levels defined in the import source.

Syntax

Version 0.1.0+

level1/level2/level3;;level1bis/level2bis/level3bis

Branches get separeted by: ;;

Version 0.0.x

level1/level2/level3,level1bis/level2bis/level3bis

Branches are separeted by: ,

Usage

Each branch level should be separated by: /

Non existing levels will be automatically created. Existing levels will be reused.

The above description will lead to the following category tree to be created/used Root Category

+level1
 + level2
   + level3
+level1bis
 + level2bis
   +level3bis

if a futher item in the source has the following categories column level1/levelextra2;;levelextra1

the tree will become Root Category

+level1
 + level2
   + level3
 + levelextra2
+level1bis
 + level2bis
   +level3bis
+levelextra1

and so on...

so the category tree will be built "on the fly".

Category Options

To provide additional options for new categories, the following syntax can be used:

category name::[is_active]::[is_anchor]::[include_in_menu]

where:

  • is_active: 0 or 1 - category is_active flag (defaults to 1 if not set)
  • is_anchor: 0 or 1 - category is_anchor flag (defaults to 1 if not set)
  • include_in_menu: 0 or 1 - category include_in_menu flag (defaults to 1 if not set)

Examples

Basic example

The following csv will add a two products and put them into a simple category tree.

sku;name;attribute_set;store;categories
"100";"Product 1";"Default";"en";"My Products/Sample Products/Sample Category"
"101";"Product 2";"Default";"en";"My Products/Other Products"

Defining category options

The same example as above, except for a few category options.

sku;name;attribute_set;store;categories
"100";"Product 1";"Default";"en";"My Products::1::0::1/Sample Products/Sample Category::1::0::0"
"101";"Product 2";"Default";"en";"My Products::1::0::1/Other Products"

Advanced usage

The base category tree may be interesting to use it in conjunction with import limiter , so you can prepend a category tree for only some of the input data (using some limiter ranges or filters) and use another base tree for another set of input data (using other limiter ranges/filter)

Multiple Store roots management

Explicit store root naming

IMPORTANT

STORE CATEGORY ROOT NAMES HAVE TO BE PUT BETWEEN SQUARE BRACKETS [] TO BE IDENTIFIED AS CATEGORY ROOT NAMES


The plugin will try to detect on which root(s) to create the categories listed in the item line.

  • if store column is set with non admin:
    • will create categories under each root of listed stores
  • if store column is set to admin:

version <0.2

    • will create categories for each root of main stores of the listed websites

version 0.2+

    • will create rooted trees under corresponding root
    • will create unrooted trees under main store root


Say we have :

  • store1 with StoreRootName1 root category name
  • store2 with StoreRootName2 root category name
  • store1 is main store
store,sku,...,categories
root,00001,....,[StoreRootName1]/level1s1;;[StoreRootName2]/level1s2 <= THE STORE ROOT CATEGORIES HAVE TO BE ENCLOSED INSIDE SQUARE BRACKETS !!!!

will create

+StoreRootName1 (existing)
  +level1s1 (created if non existing)
+StoreRootName2 (existing)
  +level1s2 (created if non existing)

Now, unrooted line

store,sku,...,categories
root,00002,....,level1s1/level2

now cat tree will be

+StoreRootName1 (existing)
  +level1s1 (existing from 1st sample)
   +level2s1 (created since no explicit root will use main store root as cat root)
+StoreRootName2 (existing)
  +level1s2 (created if non existing)

Tree Separator escaping (from version 0.2)

The new 0.2 supports category tree separator escaping (in case of category names matching tree separator (which is "/" by default)

Sample

store,sku,....,categories
admin,00001,.....,cat name with \/ in the name <= here we "escaped" the tree separator with a backslash , the category will be created as "catname with / in the name"

Item positioning

From magmi 0.7.18 , category_ids column has been enhanced with item positioning. This feature is also supported in category importer from version 0.2+ (since category importer plugin is roughly a category_ids generator)


Sample

store,sku,....,categories
admin,00001,.....,cat name with \/ in the name and positioning::3 <= here we "escaped" the tree separator with a backslash , the category will be created as "catname with / in the name and positioning"
                                                                     sku 00001 will be set with position 3 in the category




Back to Product Import Related Plugins