In my Hybris setup, I have a custom type where one of the fields is a collection of products. In a backoffice screen for the type, I have a multi-reference editor to select the relevant products for the collection. Now, I want to restrict the products to Online catalogue only (i.e. not show products from Staged product catalogue). The relevant documentation page indicates that I can use this syntax:
<editorArea:attribute qualifier="products">
<editorArea:editor-parameter>
<editorArea:name>referenceSearchCondition_catalogVersion</editorArea:name>
<editorArea:value>{parentObject.catalogVersion}</editorArea:value>
</editorArea:editor-parameter>
</editorArea:attribute>
In my case, however, the custom type does not have the catalogVersion
attribute, so I would really like to do something like this instead:
<editorArea:attribute qualifier="products">
<editorArea:editor-parameter>
<editorArea:name>referenceSearchCondition_catalogVersion</editorArea:name>
<editorArea:value>Online</editorArea:value>
</editorArea:editor-parameter>
</editorArea:attribute>
This does not work (naturally), as the parentObject.catalogVersion
is the PK. In my testing, if I specify the actual catalog version PK instead of Online
, I do get the results I need, yet, obviously, hardcoding the PK is not an option. So, how can I use the referenceSearchCondition
to compare with a field of catalog version, referred to by the field in my custom type?
The only solution/workaround(not really ideal) that came to my mind right now after taking a look into the documentation and the accelerator code provided by SAP is doing the following:
Create a dynamic attribute which retrieves the PK of the catalogVersion Online on the parent (Ex: name it catalogVersionOnlinePK).
Then you can access the PK value directly: