You may want to enable users to search the child price lists of a master price list.
About this task
In such a scenario, you can add the master price list ID attribute to the list of advanced price
list search attributes. Because master price list IDs are string values, you can allow the query
types, starts with or is, and use a text box as the input control.
To add the
master price list ID as a search criteria:
Procedure
- Create the Pricelist.xml file in the <install_dir>/extensions/sbc/webpages/sbc/metadata/advancedsearch
folder if the file does not exist in the folder. Ensure that the root
element of the XML is Attributes.
- Create an Attribute element as a
child element of the Attributes root element.
- Set the value of the Action XML attributes to ADD.
- Set the value of the Name XML attribute to PricelistName in
the Attribute element. This is because the XML attribute that is set
with the master price list ID in the input XML is PricelistName.
- Set the value of the XPath XML attribute to PricelistHeader\InheritFromPricelistHeader in
the Attribute element. This is because the XML path of the PricelistName
attribute for the master price list ID is PricelistHeader\InheritFromPricelistHeader.
- To define the user interface (UI) label in the search attribute
drop-down list, set the DisplayName XML attribute
to any key. Ensure that you add a bundle entry as the key for this
attribute.
- To use a text field for the attribute, set the xtype XML
attribute to xadvancedtextcontrol.
- Create an element, Configuration,
as the child element of the Attribute element.
- Create an element, UIControlConfiguration,
as the child element of the Configuration element.
- To use only a few string query types, create the element, StringQueryTypes,
as the child element of the Attribute element.
- To support the is and starts
with query types, perform the following steps:
- Add the QueryType elements with the value of the QueryType
XML attribute as EQ and FLIKE.
- To customize the query type description, set the value
of the QueryTypeDesc XML attribute to the correct bundle key.
The search attribute is added.
Following is the newly
added attribute element for the master price list ID field:
<Attribute Action="ADD" Name="PricelistName" DisplayName="b_Price_List_Name"
XPath="PricelistHeader/InheritFromPricelistHeader">
<Configuration>
<UIControlConfiguration xtype="xadvancedtextcontrol"/>
</Configuration>
<StringQueryTypes>
<QueryType QueryType="EQ" QueryTypeDesc="is"/>
<QueryType QueryType="FLIKE"/>
</StringQueryTypes>
</Attribute>