Skip to main content

Magento Product Category from iPaaS

Transfer product categories from iPaaS to Magento

Updated over 2 weeks ago

Overview

Magento Product Category can be transferred from iPaaS.com using an Add/Update sync method. This mapping supports the automated synchronization of Product Category records from iPaaS into Magento via the Product Category API.

Mapping Collection Status

  • Mapping Status: Enabled.

  • Trigger Events: The sync is triggered by the creation or update of Product Category in Magento.

  • ID Format: When manually syncing, the Product Category ID from iPaaS is used.

  • Conflicting Mappings: This mapping applies only to Product Category. Ensure no other mappings target the same Magento entity to prevent data from being overwritten.

Custom Field Support

Custom fields from the source system can be mapped or retrieved in iPaaS.com flows if additional information (such as external identifiers or attributes) is required during the sync.

To transfer custom field data to iPaaS.com, use the following formula:

return GetValueFromCustomField(AdditionalProperties, "[CustomFieldId]");

This function retrieves the value of a custom field using its ID in the From iPaaS.com flow.

System Caveats

Magento Caveats

  • Magento requires valid ParentId and Name for all categories.

  • Shared Catalogs are treated as specialized categories in Magento. If the IsSharedCatalog flag is missing or incorrect, the record will be processed as a regular category.

  • The StoreId_Catalog must resolve to a valid Magento store; otherwise, the sync for that record will fail.

iPaaS.com Caveats

  • Categories with IsSharedCatalog = true are excluded from this mapping and handled separately.

  • If the filter is removed, Shared Catalog records may be created as standard categories, leading to data inconsistency.

  • SharedCatalogIds must be defined as a custom field exactly by that name for Shared Catalog assignment to function correctly.

Setup Requirements

Magento Configuration

  • ParentId: The parent category under which the new category will be created.

  • Name: The display name of the category in Magento.

  • IsActive: Indicates whether the category is enabled.

  • Position: Used to control the order of categories under the same parent.

  • StoreId_Catalog: Used for assigning categories to specific Magento stores.

iPaaS.com Configuration

  • IsSharedCatalog (custom field): Used to distinguish between Shared Catalogs and standard Categories.

  • SharedCatalogIds (custom field): Contains the IDs of Shared Catalogs linked to the current category (optional).

  • StoreId_Catalog: Must contain a valid store name that resolves to a valid Magento Store ID.

Authentication & Security

  • Magento2 API UserName: Used to access iPaaS API for fetching Company and related data.

  • Magento2 API Key: Used to access iPaaS API for fetching Company and related data.

Integration Flow

  1. Retrieve Data: iPaaS retrieves category records with the filter applied to exclude Shared Catalogs.

  2. Validate Custom Field: Checks the IsSharedCatalog value — only records where this is null or false are processed.

  3. Map Fields: iPaaS maps category fields and performs lookups for ParentId, Position, and Store assignments.

  4. Sync Category: The mapped data is sent to Magento for category creation or update.

  5. Optional Assignment: If SharedCatalogIds and StoreId_Catalog exist, they are used for category assignment in multi-store or shared catalog configurations.

Mappings

Magento Product Category From iPaaS

Mapping Type

Source (iPaaS.com)

Destination (Magento)

Description

Dynamic Formula

SharedCatalogIds (custom field)

SharedCatalogIds (custom field)

This mapping is essential for assigning a single product category to multiple Shared Catalogs, thereby establishing a one-to-many relationship. It utilizes a record-level custom field named "SharedCatalogIds", whose value is assigned to a subscription-level custom field with the same name. This value represents the iPaaS product category IDs, separated by commas (,). These IDs are later used in the handle prerequisite step to validate whether each ID corresponds to a valid iPaaS product category. During this validation, the system checks whether the referenced category has the custom field IsSharedCatalog. If the field is missing or explicitly set to false, the category is created as a shared catalog from prerequisite. This transfer is created using the shared catalog mapping collection rather than the current mapping, ensuring that the category is assigned to the appropriate, predefined Shared Catalogs later during create/update of category.

Dynamic Formula

var external = await GetExternalIdAsync(ParentId, "Product Category", SpaceportSystemId); return COALESCE(external, "2");

ParentId

Field

Name

Name

Static

true

IsActive

Dynamic Formula

CoalesceToInt(GetCustomFieldValue(CustomFields, "Sort Order"), 0)

Position

Dynamic Formula

var sharedCatalogIds = GetCustomFieldValue(CustomFields, "Shared Catalog Ids"); if(!string.IsNullOrWhiteSpace(sharedCatalogIds)){ return await GetStoreIdByName("B2B Store View"); } return null;

StoreId_Catalog

This mapping is essential/required for assigning a single product category to multiple Shared Catalogs, establishing a one-to-many relationship. The provided formula utilizes the store name to retrieve its corresponding store ID. If a valid store name is provided, the function returns the appropriate store ID. However, if an invalid or unrecognized store name is supplied, the function defaults to returning 0, which corresponds to the Admin (default) store view in Magento. It's important to note that in Magento, store ID 0 represents the Admin store view, which serves as the default context for global data. Assigning categories to Shared Catalogs under store ID 0 may lead to unexpected behavior, since Shared Catalogs are typically tied to specific websites or store views. Therefore, to ensure accurate assignment of categories to the intended Shared Catalogs, it's crucial to provide valid and existing store names. Alternatively, if stricter validation is preferred, an exception can be raised when the returned store ID is 0, as the commented code in the mapping formula suggests. This approach prevents assignments to unintended store views by ensuring the presence of a valid store mapping before proceeding. Use either approach depending on your business requirements and error-handling preferences. If this functionality is not required, you may remove this mapping to prevent any unintended assignments. For more information on Magento's store architecture and Shared Catalogs, you can refer to the following resources: Shared Catalog Overview | Adobe Commerce - Experience LeagueMagento 2 Shared Catalog Guide - Firebear Studio These resources provide comprehensive insights into managing Shared Catalogs and understanding Magento's store hierarchy.

Note: Even if the shared catalog mapping collection specifies a different store at the mapping level, and this mapping itself has a different store configured, the assignment will not be affected. Categories will still be assigned across the specified shared catalogs as expected.

Error Handling

Collection: Product Category (Parent)

Missing Category Name

  • Description: The Name field is required for Magento category creation.

  • Resolution: Ensure each iPaaS category record includes a valid Name.

Invalid ParentId

  • Description: The specified ParentId could not be resolved or does not exist in Magento.

  • Resolution: Validate Parent category existence and mapping references.

Invalid StoreId_Catalog

  • Description: The store name or store ID provided could not be resolved in Magento.

  • Resolution: Verify that the StoreId_Catalog field contains a valid Magento store reference.

Shared Catalog Category Misclassification

  • Description: The category has IsSharedCatalog = true but is processed through the standard mapping.

  • Resolution: Ensure the mapping filter is defined exactly as specified to separate Shared Catalog categories.

Validation Rules & Testing

Validation Checklist

  • IsSharedCatalog field correctly identifies Shared Catalogs (true = excluded).

  • Category hierarchy (ParentId) maps correctly.

  • Store resolution through StoreId_Catalog functions as expected.

  • Active status (IsActive) applied successfully.

  • SharedCatalogIds correctly referenced when applicable.

Test Scenarios

  1. Sync standard category without IsSharedCatalog field: Verify Magento category created successfully.

  2. Sync category with IsSharedCatalog = true: Confirm record is excluded from this mapping and handled by Shared Catalog mapping.

  3. Sync with missing ParentId: Confirm error “Invalid ParentId.”

  4. Sync with invalid StoreId_Catalog: Confirm error “Invalid StoreId_Catalog.”

Additional Notes

  • If Shared Catalog functionality is supported, the mapping filter must remain correctly differentiate between standard categories and Shared Catalogs.

Did this answer your question?