Nexussim Lements
Nexussim Lements

Reputation: 787

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?

Upvotes: 1

Views: 1747

Answers (2)

Raushan Kumar
Raushan Kumar

Reputation: 1248

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

Upvotes: 2

dj_frunza
dj_frunza

Reputation: 1593

Try adding the new type(i.e BrandCategory) into your product synchronization job as a root type as depicted in below image: enter image description here

Upvotes: 1

Related Questions