Hybris BackOffice:用户组内B2BUnit列表搜索自定义需求
自定义Hybris BackOffice B2BUnit列表直接搜索条件的实现方案
核心配置步骤
1. 修改BackOffice快速搜索字段配置
在自定义扩展的*-backoffice-config.xml(或默认的backoffice-config.xml)中,为B2BUnit类型添加目标搜索属性:
<context type="B2BUnit" component="search"> <fs:search> <!-- 保留默认的code和name搜索规则 --> <fs:field name="code" operator="contains"/> <fs:field name="name" operator="contains"/> <!-- 新增需要的搜索属性,示例为taxId,替换为你的目标属性名 --> <fs:field name="taxId" operator="contains"/> </fs:search> </context>
operator可选值:contains(模糊匹配)、equals(精确匹配)、startsWith(前缀匹配),可根据需求调整。
2. 适配Solr索引(若启用Solr作为BackOffice搜索后端)
如果你的BackOffice使用Solr提供搜索能力,需同步更新Solr索引配置:
- 在Solr配置impex文件(如
b2bcommerce-backoffice/solr.impex)中添加索引字段:
INSERT_UPDATE SolrIndexedProperty;solrIndexedType(identifier)[unique=true];name[unique=true];type(code);localized[default=false] ;B2BUnit;taxId;string;false
- 执行索引更新命令:
ant solr.reindex -Dsolr.index.name=B2BUnit
3. 验证效果
重启Hybris服务器后,登录BackOffice进入用户组模块的B2BUnit列表页,直接在顶部搜索框输入新增属性的内容,即可看到匹配的结果。
额外注意事项
- 确保目标属性已在
B2BUnit的items.xml中定义,且BackOffice对应用户组拥有该属性的读取权限; - 高级搜索配置与快速搜索配置相互独立,无需删除之前的高级搜索设置。
内容的提问来源于stack exchange,提问作者jyoti
相关产品推荐
相关产品推荐

