【问题标题】:Update Categories in Hybris for products更新 Hybris 中的产品类别
【发布时间】:2017-01-20 21:04:31
【问题描述】:

我在 Hybris 中分配了多个具有不同超级类别的产品。

我通过 impex 将超级类别添加到这些产品中。

$supercategories=supercategories(code,$catalogVersion)
UPDATE Product;code[unique=true];$catalogVersion[unique=true];supercategories(code,$catalogVersion)[mode=append]
;ProductName;;1017
;ProductName1;;1017

我想知道是否有一种方法可以在我将类别分配给产品时定义哪个超级类别首先出现,或者可以通过更新来决定哪个超级类别最先出现。

总之,我需要超级类别 368 成为第一个。

Currently is         New Result
297                    368
368                    686  
686                    297

【问题讨论】:

  • 从某种意义上说,哪个先行?您是在谈论显示类别的顺序吗?

标签: hybris


【解决方案1】:

您需要更改关系才能为超类别启用ordered="true"

ordered="boolean" [0..1]

如果为“真”,则会生成一个额外的排序属性来维护排序。默认为“假”。

OOTB:

<relation code="CategoryProductRelation" autocreate="true" generate="true" localized="false">
        <deployment table="Cat2ProdRel" typecode="143"/>
        <sourceElement qualifier="supercategories" type="Category" cardinality="many" ordered="false">
            <description>Super Categories</description>
            <modifiers read="true" write="true" search="true" optional="true"/>
        </sourceElement>
        <targetElement qualifier="products" type="Product" cardinality="many" collectiontype="list" ordered="true">
            <description>Products</description>
            <modifiers read="true" write="true" search="true" optional="true"/>
        </targetElement>        
    </relation>

到:

<relation code="CategoryProductRelation" autocreate="true" generate="true" localized="false">
        <deployment table="Cat2ProdRel" typecode="143"/>
        <sourceElement qualifier="supercategories" type="Category" cardinality="many" ordered="true">
            <description>Super Categories</description>
            <modifiers read="true" write="true" search="true" optional="true"/>
        </sourceElement>
        <targetElement qualifier="products" type="Product" cardinality="many" collectiontype="list" ordered="true">
            <description>Products</description>
            <modifiers read="true" write="true" search="true" optional="true"/>
        </targetElement>        
    </relation>

我不确定redeclare=true 是否适用于关系标签,但由于对于超类别 order="false",除非其为真,否则不会维持顺序。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-07
    • 2018-01-31
    相关资源
    最近更新 更多