【问题标题】:How to extend the Spartacus PLP page如何扩展 Spartacus PLP 页面
【发布时间】:2021-06-10 20:39:25
【问题描述】:

在 Spartacus PLP 页面中,我正在尝试扩展 PLP 页面。 下面是模块和ts代码

ConfigModule.withConfig({
      cmsComponents: {
        CMSProductGridComponent: {
          component: ProductsGridComponent
        }
      }
    } as CmsConfig)

在ts文件中 导出类 ProductsGridComponent 扩展 ProductGridItemComponent{}

问题 OOTB 搜索调用未发生。当我评论模块文件中的覆盖时,OOTB 搜索 API 正在发生。扩展 PLP 页面有什么错误吗? 有什么帮助吗?

【问题讨论】:

    标签: spartacus-storefront


    【解决方案1】:

    查看 CategoryPageMetaResolver。看来您可能必须覆盖 hasProductListComponent 检查:

    • 您需要创建一个扩展 CategoryPageMetaResolver 的服务。

    • 覆盖 hasProductListComponent 以便它识别您的
      ProductsGridComponent 作为“ProductListComponent”。

    • 在一个模块中提供服务 - {provide:CategoryPageMetaResolver,useClass:MyCategoryPageMetaResolver}。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-22
      • 1970-01-01
      相关资源
      最近更新 更多