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

问题描述

我已经创建了自己的 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)外,所有类别都会复制到在线。

我该如何修复这个错误

解决方法

您需要更新 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=false

或者通过启用代码执行来运行impex。 enter image description here

,

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...