categoriessap-commerce-cloudhybris-data-hub

Hybris custom Category itemtype not syncing


I've created my own Itemtype extending Category:

<itemtype code="BrandCategory" extends="Category">
            <attributes>
                <attribute qualifier="hide" type="java.lang.Boolean">
                    <persistence type="property"/>
                    <defaultvalue>java.lang.Boolean.FALSE</defaultvalue>
                    <modifiers read="true" write="true" optional="false" search="true"/>
                </attribute>
            </attributes>
        </itemtype>

However, when I assign this category to any Product that already has other categories and I do a catalog synchronization, all the categories do copy to online except the custom ones (BrandCategory).

How can I fix this bug?


Solution

  • you need to update SyncAttributeDescriptorConfig and it can be done either via Backoffice or via Impex.

    "#%groovy%
    def query = '''SELECT {pk} FROM {<CustomJOBName>CatalogVersionSyncJob}'''
    def syncJobs = flexibleSearchService.search(query).result
    
    //forcing all sync jobs to create sync descriptors, if not created
    syncJobs.each { syncJob -> syncJob.getSyncAttributeConfigurations() }
    "
    
    UPDATE GenericItem[processor = de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor]; pk[unique = true]
    $attribute = attributeDescriptor(enclosingType(code), qualifier)[unique = true]
    
    UPDATE SyncAttributeDescriptorConfig[batchmode = true]; $attribute                ; includedInSync
                                                          ; BrandCategory:hide ; true
    
    UPDATE AttributeDescriptor; enclosingType(code)[unique = true]; qualifier[unique = true]; unique
                              ; BrandCategory              ; catalogVersion          ; true
    

    To run groovy in Impex, please add this property to local. properties.

    Disable legacy scripting (makes groovy work at impex)

    impex.legacy.scripting=false

    or run impex via enabling the code execution. enter image description here