CategoryTree loader

It loads given rows to the spy_category_node and spy_category_closure_table tables. The Category.tree.publish event is triggered.

Warning

Unique Constraint Suggested to Prevent Duplicates

To ensure data integrity and prevent duplicate entries when running the importer multiple times with the same dataset, it is strongly recommended to add a unique constraint on the fk_category_node and fk_category_node_descendant columns.

Without these constraints, duplicate relationships may be inserted on each import execution, leading to redundant data in the database.

Suggested SQL Constraint:

<table name="spy_category_closure_table">
    <unique name="uqc_category_closure_table">
        <unique-column name="fk_category_node"/>
        <unique-column name="fk_category_node_descendant"/>
    </unique>
</table>

By enforcing this constraint, the CategoryTreeLoader can reliably handle repeated imports without unintentionally duplicating entries.

Usage:

<category-tree
     categoryNodeIdField="categoryNodeId"
     categoryIdField="categoryId"
     categoryKeyField="categoryKey"
     parentCategoryIdField="parentCategoryId"
     parentCategoryKeyField="parentCategoryKey"
     isMainCategoryNodeField="isMainCategoryNode"
     isRootCategoryNodeField="isRootCategoryNode"
     categoryNodeOrderField="categoryNodeOrder"
/>

Attributes:

  • categoryNodeIdField - name of the field where the category node id should be set

  • categoryIdField - name of the field containing the category id

  • categoryKeyField - name of the field containing the category key

  • parentCategoryIdField - name of the field containing the parent category id

  • parentCategoryKeyField - name of the field containing the parent category key

  • isMainCategoryNodeField - name of the optional field containing the boolean isMain value, if not set Spryker Database default is used

  • isRootCategoryNodeField - name of the optional field containing the boolean isRoot value, if not set Spryker Database default is used

  • categoryNodeOrderField - name of the optional field containing the node order value, if not set Spryker Database default is used