Hybris 自定义类别项目类型不同步

Hybris custom Category itemtype not syncing

我创建了自己的 Itemtype 扩展类别:

<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>

但是,当我将此类别分配给任何已有其他类别的产品并进行目录同步时,除自定义类别 (BrandCategory) 外,所有类别都会复制到在线。

我该如何修复这个错误?

尝试将新类型(即 BrandCategory)作为根类型添加到您的产品同步作业中,如下图所示:

您需要更新 SyncAttributeDescriptorConfig,这可以通过 Backoffice 或 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

到Impex中的运行 groovy,请将此属性添加到本地。属性。

禁用遗留脚本(使 groovy 在 impex 工作)

impex.legacy.scripting=假

或运行 impex 通过启用代码执行。