【问题标题】:Hybris reference editor - filter using catalog versionHybris 参考编辑器 - 使用目录版本过滤
【发布时间】:2021-03-09 16:33:51
【问题描述】:

在我的 Hybris 设置中,我有一个自定义类型,其中一个字段是产品集合。在该类型的后台屏幕中,我有一个多参考编辑器来选择集合的相关产品。现在,我想将产品限制为仅在线目录(即不显示暂存产品目录中的产品)。相关的documentation page表示可以使用这个语法:

<editorArea:attribute qualifier="products">
    <editorArea:editor-parameter>
        <editorArea:name>referenceSearchCondition_catalogVersion</editorArea:name>
        <editorArea:value>{parentObject.catalogVersion}</editorArea:value>
    </editorArea:editor-parameter>
</editorArea:attribute>

然而,就我而言,自定义类型没有catalogVersion 属性,所以我真的很想这样做:

<editorArea:attribute qualifier="products">
    <editorArea:editor-parameter>
        <editorArea:name>referenceSearchCondition_catalogVersion</editorArea:name>
        <editorArea:value>Online</editorArea:value>
    </editorArea:editor-parameter>
</editorArea:attribute>

这不起作用(自然),因为parentObject.catalogVersion 是PK。在我的测试中,如果我指定实际的目录版本 PK 而不是 Online,我会得到我需要的结果,但显然,硬编码 PK 不是一种选择。那么,如何使用referenceSearchCondition 与我的自定义类型中的字段引用的目录版本字段进行比较?

【问题讨论】:

    标签: hybris backoffice


    【解决方案1】:

    查看文档和 SAP 提供的加速器代码后,我现在想到的唯一解决方案/解决方法(不是很理想)正在执行以下操作:

    1. 创建一个动态属性,用于检索父目录上 Online 的 PK(例如:将其命名为 catalogVersionOnlinePK)。

    2. 那么就可以直接访问PK值了:

       <editorArea:attribute qualifier="products">
          <editorArea:editor-parameter>
              <editorArea:name>referenceSearchCondition_catalogVersion</editorArea:name>
              <editorArea:value>{parentObject.catalogVersionOnlinePK}</editorArea:value>
          </editorArea:editor-parameter>
      </editorArea:attribute>
      

    【讨论】:

      【解决方案2】:

      不确定它是否会 OTTB,但试试这个

      <editorArea:attribute qualifier="products">
         <editorArea:editor-parameter>
             <editorArea:name>referenceSearchCondition_catalogVersion.version</editorArea:name>
             <editorArea:value>Online</editorArea:value>
         </editorArea:editor-parameter>
      </editorArea:attribute>
      

      【讨论】:

        【解决方案3】:

        我有几乎相同的要求并以这种方式解决了它:

        <wz:editor-parameter>                                
            <wz:name>referenceSearchCondition_catalogVersion_in</wz:name>
            <wz:value>{@customCatalogVersionService.getOnlineCatalogVersions()}</wz:value>
        </wz:editor-parameter>
        

        此外,我还需要通过将其添加到相应的*backoffice-spring.xml 来使customCatalogVersionService 可用:

        <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:cng="http://www.hybris.com/cockpitng/spring"
               xmlns="http://www.springframework.org/schema/beans"
        
               xsi:schemaLocation="http://www.springframework.org/schema/beans
                    http://www.springframework.org/schema/beans/spring-beans.xsd
                    http://www.hybris.com/cockpitng/spring
                    http://www.hybris.com/cockpitng/spring/cng-spring.xsd">
        
            ...
        
            <cng:list-extender bean="fixedBeanResolver" property="availableBeanNames">
                <cng:add value-type="java.lang.String">
                    <value>customCatalogVersionService</value>
                </cng:add>
            </cng:list-extender>
        

        【讨论】:

          猜你喜欢
          • 2013-03-05
          • 1970-01-01
          • 2015-04-25
          • 1970-01-01
          • 1970-01-01
          • 2019-03-13
          • 2013-07-27
          • 2011-01-22
          • 1970-01-01
          相关资源
          最近更新 更多