Generate category codes

Summary

Early Access

This feature is in early access. Reach out to your Akeneo contact if you're interested in trying it out.

Category Code Generator overview

The Category Code Generator in Akeneo PIM automates the generation of category codes during the creation of new categories. Instead of entering a code manually, you configure a generator that builds the code from a configurable template — combining static text, auto-incrementing numbers, and values derived from the root category.

With the Category Code Generator, you can:

  • Define the structure of category codes using different property types
  • Target specific Category Trees for code generation
  • Manage custom abbreviations (nomenclature) for each root category

Create a Category Code Generator

To create a Category Code Generator in Akeneo PIM, go to Settings > Category Code Generator.

If you don't see the Category Code Generator menu item or the Create button, check with your administrator that you have the appropriate permissions.

Once you have created and saved a generator, it is immediately active: a code is automatically generated every time a new category is created in the targeted Category Trees if no code is provided manually.

When creating a generator, a modal window first asks you to fill in a label and a code. The label must not exceed 255 characters. The code must be unique, alphanumeric (underscores allowed), and no longer than 100 characters. It is auto-filled from the label but can be modified manually.

After confirming, you are taken to the full editor page, organized into three tabs: General Properties, Selection, and Structure.

One generator per Category Tree. Each Category Tree can only be covered by a single generator. The Create button is disabled once all Category Trees are assigned to a generator.

General Properties tab

In the General Properties tab of the Category Code Generator, you can:

  • View the generator code (read-only after creation)
  • Set the text transformation to apply to the generated code:

    • No transformation: the code is generated as-is (e.g. Print_CAT_0001)
    • Uppercase: the code is fully uppercased (e.g. PRINT_CAT_0001)
    • Lowercase: the code is fully lowercased (e.g. print_cat_0001)
    • Add label translations for each of your UI locales

Selection tab

In the Selection tab of the Category Code Generator, you define which Category Trees the generator applies to. You can select one or more specific Category Trees, or choose All category trees to apply the generator to all trees not already assigned to another generator.

Selecting All category trees is only available if no other generator already covers all trees. Once one generator covers all trees, the option is no longer available for new generators.

The screenshot above shows the Selection tab of the Category Code Generator, with a category tree selector that allows choosing one or more specific trees or the "All category trees" option.

Define the structure

In the Structure tab of the Category Code Generator, create the template applied when generating a category code. Click Add new property to add one or more properties to the structure. You can include up to 20 properties.

Properties can be reordered by drag and drop.

The screenshot above shows the Structure tab with a list of configured properties (Free text, Auto number, Category tree) and a live preview of the generated code at the top.

Free text

  • Inserts a static text string in the code.
  • Must not be blank and must not exceed 50 characters. Leading or trailing spaces are not accepted.
  • You can add multiple Free text properties.

Auto number

  • Inserts an auto-incrementing number.
  • Minimum digits: sets the minimum length of the number. If the number is shorter, it is padded with leading zeros. Example: if set to 4, the number 5 is rendered as 0005. Accepts values between 1 and 15.
  • Minimum number: the starting value for the sequence. Example: if set to 100, the first generated code includes 0100 (assuming 4 minimum digits).

Your structure can contain only one Auto number property.

The Auto number always uses the value one higher than the last number ever generated for the same prefix. Deleting a category does not reset the sequence. To fully reset it, you must delete both the category and the generator, then create a new generator.

Category tree (root category code)

Inserts a value derived from the root category code of the category being created. Three formats are available:

  • Category tree code: uses the full root category code as-is.
  • Category tree code (first characters): uses only the first N characters of the root category code. You can configure:

    • The operator: Is equal to (=) or Lower than or equal to (≤)
    • The number of characters: between 1 and 5
    • Category tree code (with nomenclature): uses a custom abbreviation you define for each root category. See the Nomenclature section below.

Delimiter

By default, no delimiter is added between properties. Tick the checkbox Use delimiters between each property to activate it. The only accepted delimiter is _ (underscore).

Nomenclature: custom abbreviations for root categories

When you choose the Category tree code (with nomenclature) format for the Category Tree property in the Category Code Generator, you can define a custom short code for each of your root categories. This is useful when root category codes are long or inconsistent.

To edit the nomenclature, click Edit nomenclature in the property settings panel. A modal window opens with two sections:

The screenshot above shows the Category Nomenclature modal with a "Global Rules" section at the top (operator and character count settings) and a "Category Nomenclatures" table listing each root category with its abbreviation field.

Global rules

Set the operator and number of characters that apply by default to all root categories:

  • = (Is equal to): the abbreviation must contain exactly N characters. Root category codes shorter than N produce a validation error and must be corrected before saving.
  • ≤ (Lower than or equal to): the abbreviation can contain at most N characters. This is more permissive and works well when some root category codes are shorter than others.

The number of characters must be between 1 and 5.

You can also tick Generate if no mapping found: if a root category has no nomenclature value defined, the system automatically falls back to the first N characters of its code.

Category nomenclatures

The table lists all your root categories with their label, code, and a field to enter the abbreviation. If Generate if no mapping found is enabled, an auto-generated placeholder is shown. You can search categories by label or code if you have more than 5 root categories.

Nomenclature values are shared across all your Category Code Generators. Changing them in one generator affects all generators that use the Category tree code (with nomenclature) format.

Live preview

A live preview of the generated code is shown at the top of the Structure tab, reflecting your current configuration. It updates automatically as you add, remove, or modify properties. The preview respects the text transformation setting configured in the General Properties tab.

When is a category code generated?

The Category Code Generator in Akeneo PIM triggers code generation in the following cases:

  • Only at category creation: a code is generated automatically when a new category is created and no code is provided manually.
  • The code is never overwritten: if a category already has a code, the generator does not replace it.
  • Generation is triggered through the Akeneo PIM UI, via import, or via the API.

Existing categories are not updated when a generator is created or modified. Only newly created categories benefit from automatic code generation.

Edit or delete a Category Code Generator

Modifying or deleting a generator has no impact on codes already generated: all existing category codes remain unchanged. Only categories created after the change are affected.

To edit or delete a Category Code Generator in Akeneo PIM:

  1. Go to Settings > Category Code Generator.
  2. Click on a generator in the list to edit it, or click the Delete button to remove it.
  3. Confirm the deletion when prompted.

Manage permissions

Two permission levels exist for the Category Code Generator:

  • View category code generators: users can view the list of generators and their settings, but cannot create, edit, or delete them.
  • Manage category code generators: users have full rights to create, edit, and delete generators, and to edit the nomenclature.

By default, all users can view the Category Code Generator section. Administrators can remove this access entirely by unticking all permissions for a given user.