> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Synchronization of Categories from Akeneo to Spryker

## **Fetching Categories from Akeneo**

* In Alumio, go to **"Integrations → Incoming → Akeneo - Fetch - Categories"**.
* To get all categories from the Akeneo system, use an Incoming **"Akeneo - Fetch - Categories"**.

<Frame>
  <img src="https://mintcdn.com/alumio/T6P8LMOsJ4ESrdHv/images/image-15.png?fit=max&auto=format&n=T6P8LMOsJ4ESrdHv&q=85&s=fe2e1553f4c6c7a2320b3ae0fc24c8eb" alt="Image" width="1085" height="603" data-path="images/image-15.png" />
</Frame>

This incoming will create a task inside Alumio with data structured as Alumio base categories. There some transformer inside this Incoming before processing the category.

1. Akeneo - Prepare convert category - Labels - To localizations.
2. Akeneo - Convert - Category - To Alumio Base.
3. Akeneo - Filter - Category.

**Akeneo - Prepare convert category - Labels - To localizations**

This transformer converts label data from Akeneo.

```json theme={null}
{
  "labels": {
    "de_DE": "E-commerce",
    "en_GB": "E-commerce",
    "en_US": "E-commerce",
    "es_ES": "E-commerce",
    "fr_FR": "E-commerce",
    "it_IT": "E-commerce",
    "nl_NL": "E-commerce",
    "pt_PT": "E-commerce"
  }
}
```

Since the current data structure is incompatible with Spryker, the transformer "**Akeneo - Convert - Category - To Alumio Base**" is used to convert it into a compatible format.

```json theme={null}
{
  "localizations": [
    {
      "localeCode": "de_DE",
      "translation": "E-commerce"
    },
    {
      "localeCode": "en_GB",
      "translation": "E-commerce"
    },
    {
      "localeCode": "en_US",
      "translation": "E-commerce"
    },
    ....
  ]
}
```

An example of the Alumio base category:

```json theme={null}
{
  "code": "master",
  "parent": null,
  "localizations": [
    {
      "localeCode": "de_DE",
      "translation": "E-commerce"
    },
    {
      "localeCode": "en_GB",
      "translation": "E-commerce"
    },
    {
      "localeCode": "en_US",
      "translation": "E-commerce"
    },
    {
      "localeCode": "es_ES",
      "translation": "E-commerce"
    },
    ...
  ]
}
```

**Akeneo - Filter - Category**

* Use this transformer to filter previously created tasks into task categories to avoid duplication.

<Frame>
  <img src="https://mintcdn.com/alumio/T6P8LMOsJ4ESrdHv/images/image-22.png?fit=max&auto=format&n=T6P8LMOsJ4ESrdHv&q=85&s=c1508cfe174a24bf34fd3acb61d90708" alt="Image" width="2032" height="676" data-path="images/image-22.png" />
</Frame>

* To recreate a task, you should remove the entity from the storage **"Akeneo - Filter - Categories"**.

## **Fetching Categories from Spryker**

* In Alumio, go to **"Integrations → Incoming → Spryker - Fetch - Categories"**.
* Before sending categories into the Spryker system, you need to know which categories already exist in the Spryker System. This Incoming is intended to fetch the categories data in the Spryker System and save them with the transformer **"Spryker - Update storage - Category full data"**. The result of this Incoming won't be created as a task but will be saved into the storage name **"Spryker - Categories - Full Data"**.

<Frame>
  <img src="https://mintcdn.com/alumio/T6P8LMOsJ4ESrdHv/images/image-23.png?fit=max&auto=format&n=T6P8LMOsJ4ESrdHv&q=85&s=103eb77a161b90d7cd8a524c36d66364" alt="Image" width="2140" height="1180" data-path="images/image-23.png" />
</Frame>

## **Sending Categories to Spryker**

* In Alumio, go to **"Integrations → Route → Akeneo Synchronize Categories to Spryker"**.
* The task in the Incoming **"Akeneo - Fetch - Categories"** will be processed in the Route **"Akeneo Synchronize Categories to Spryker"** and sent using the Outgoing **"Spryker - Send - Category"**.

Sending in the Outgoing will be processed with the following transformers:

1. Spryker - Convert - Alumio Base Category - To Spryker Category.
2. Spryker - Filter Category - Filter localized attributes by locale.
3. Spryker - Prepare Send Category - Check and fill parent sort order.
4. Spryker - Check and send - Category.
5. Spryker - Update storage - Category full data.

**Spryker - Convert - Alumio Base Category - To Spryker Category**

This transformer converts Alumio category data inside the task into Spryker category data.

```text theme={null}
{
  "data": {
    "id": "master",
    "type": "categories",
    "attributes": {
      "stores": [...],
      "isActive": true,
      "isInMenu": true,
      "categoryKey": "master",
      "isClickable": true,
      "isSearchable": true,
      "localizedAttributes": [...],
      "parent": {
        "sortOrder": "100",
        "categoryKey": "demoshop"
      }
    }
  }
}
```

This transformer requires input on the first Value setter configuration for storing information in the Spryker system and the default root parent for categories without a parent from the Akeneo System. You can modify it according to your needs.

<Frame>
  <img src="https://mintcdn.com/alumio/T6P8LMOsJ4ESrdHv/images/image-25.png?fit=max&auto=format&n=T6P8LMOsJ4ESrdHv&q=85&s=97803ea909bc3de2382ac554498c1d21" alt="Image" width="1082" height="1074" data-path="images/image-25.png" />
</Frame>

**Spryker - Filter Category - Filter localized attributes by locale**

The Spryker system requires only the store's configured locale to ensure successful synchronisation. This transformer is designed to include only the approved locale, preventing errors during the sync process. Add or remove a locale in the first Node filter.

<Frame>
  <img src="https://mintcdn.com/alumio/T6P8LMOsJ4ESrdHv/images/image-26.png?fit=max&auto=format&n=T6P8LMOsJ4ESrdHv&q=85&s=438334b4fce5ab035bcd157bbe3a6e56" alt="Image" width="1068" height="1057" data-path="images/image-26.png" />
</Frame>

By default, this transformer is configured for the English and Dutch locales.

**Spryker - Prepare Send Category - Check and fill parent sort order**

The parent sort order is set to 100 by default in the **“Spryker - Convert - Alumio Base Category - To Spryker Category”** transformer. This transformer automatically increases the sort order as additional categories are added.

**Spryker - Check and send - Category**

This transformer checks existing Spryker categories from the **“Spryker - Fetch - Categories”** incoming configuration to determine whether a category should be created or updated in the Spryker system.

**Spryker - Update storage - Category full data**

This transformer stores the created or updated category so it can be reused in subsequent iterations of the **“Spryker - Check and send - Category”** transformer.

## **Automatic Categories Synchronization Setup**

* Go to **"Integrations → Schedulers → Akeneo - Fetch Categories"**.

<Frame>
  <img src="https://mintcdn.com/alumio/T6P8LMOsJ4ESrdHv/images/image-27.png?fit=max&auto=format&n=T6P8LMOsJ4ESrdHv&q=85&s=9f47cc5ff678913a42451020badf8a3b" alt="Image" width="1105" height="841" data-path="images/image-27.png" />
</Frame>

* Set a schedule expression and enable the configuration.
* Go to **"Integrations → Schedulers → Spryker - Send Categories"**.

<Frame>
  <img src="https://mintcdn.com/alumio/T6P8LMOsJ4ESrdHv/images/image-28.png?fit=max&auto=format&n=T6P8LMOsJ4ESrdHv&q=85&s=bcfd05120bcd55096b1684d072d8a838" alt="Image" width="1089" height="1063" data-path="images/image-28.png" />
</Frame>

* Set a schedule expression and enable the configuration.
