【问题标题】:PDP Custom Routes defined in a module not working模块中定义的 PDP 自定义路由不起作用
【发布时间】:2020-04-29 23:38:05
【问题描述】:

我正在关注 Spartacus 训练营示例,用于路由 https://github.com/SAP/spartacus-bootcamp/tree/77b7474c9538eaa1032062ad3c6d461fb1fc7517/src/app/features/routing

我的问题是当我配置了自定义 PDP

imports: [
    CommonModule,
    // dependent module for semantic URLs like cxUrl
    UrlModule,
    // standard non-spartacus routes
    RouterModule.forChild(staticRoutes),
    // configure product routes
    ConfigModule.withConfig({
      routing: {
        routes: {
          product: {
            paths: [
              'product/:manufacturer/:firstCategoryName/:productCode/:prettyName',
              'product/:manufacturer/:productCode/:prettyName',
              'product/:productCode/:name',
            ],
          },
        },
      },
    } as RoutingConfig),
    //code mapping in the routes
    ConfigModule.withConfig({
      paramsMapping: {
        productCode: 'code',
      },
    } as RouteConfig),

新的 PDP 路由从未在 Storefront 中使用。我可以在浏览器控制台中看到自定义产品属性 firstCategoryName 和 prettyName 已从示例的规范化器/转换器中正确解决...

任何见解会发生什么?

谢谢!

费尔南多

【问题讨论】:

    标签: spartacus-storefront


    【解决方案1】:

    我认为这还取决于是否填充了制造商属性。默认情况下,productSearch OCC 调用中不请求制造商字段,因此不会在产品对象上填充(参见 Spartacus 代码中的 default-occ-product-config.ts) - 这意味着在产品列表页面(类别和搜索)这两个路径将无法解析,因此被忽略。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-10
      • 1970-01-01
      • 1970-01-01
      • 2013-11-04
      • 1970-01-01
      • 1970-01-01
      • 2019-01-05
      相关资源
      最近更新 更多