美文网首页SAP
SAP Spartacus里的defaultOccProduct

SAP Spartacus里的defaultOccProduct

作者: _扫地僧_ | 来源:发表于2021-01-25 10:31 被阅读0次

这个defaultOccProductConfig是一个TypeScript对象,位于文件default-occ-product-config.ts里:

export const defaultOccProductConfig: OccConfig = {
  backend: {
    occ: {
      endpoints: {
        product: {
          default:
            'products/${productCode}?fields=DEFAULT,averageRating,images(FULL),classifications,manufacturer,numberOfReviews,categories(FULL),baseOptions,baseProduct,variantOptions,variantType',
          list:
            'products/${productCode}?fields=code,name,summary,price(formattedValue),images(DEFAULT,galleryIndex)',
          details:
            'products/${productCode}?fields=averageRating,stock(DEFAULT),description,availableForPickup,code,url,price(DEFAULT),numberOfReviews,manufacturer,categories(FULL),priceRange,multidimensional,configuratorType,configurable,tags,images(FULL)',
          attributes: 'products/${productCode}?fields=classifications',
          variants:
            'products/${productCode}?fields=name,purchasable,baseOptions(DEFAULT),baseProduct,variantOptions(DEFAULT),variantType',
        },
        productReviews: 'products/${productCode}/reviews',
        // Uncomment this when occ gets configured
        // productReferences:
        //   'products/${productCode}/references?fields=DEFAULT,references(target(images(FULL)))&referenceType=${referenceType}',
        productReferences:
          'products/${productCode}/references?fields=DEFAULT,references(target(images(FULL)))',
        // tslint:disable:max-line-length
        productSearch:
          'products/search?fields=products(code,name,summary,price(FULL),images(DEFAULT),stock(FULL),averageRating,variantOptions),facets,breadcrumbs,pagination(DEFAULT),sorts(DEFAULT),freeTextSearch,currentQuery',
        // tslint:enable
        productSuggestions: 'products/suggestions',
      },
    },

在product-occ.module.ts里被导入:

providers数组里,接受一个个对象,字段名为:

  • provide: injectionToken

以上图第32行的PRODUCT_NORMALIZER为例:



DefaultConfigurationChunk:


相关文章

网友评论

    本文标题:SAP Spartacus里的defaultOccProduct

    本文链接:https://www.haomeiwen.com/subject/xvjumktx.html