问题描述
我已经创建了自己的 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
,