当前位置:网站首页>SAP Spartacus home 页面读取 product 数据的请求的 population 逻辑
SAP Spartacus home 页面读取 product 数据的请求的 population 逻辑
2022-07-06 00:35:00 【汪子熙】
Spartacus是一个开源的JavaScript web应用程序,允许您快速创建自己的基于JavaScript的SAP商务云店面。Spartacus是用Angular编写的,并以库的形式发布。使用Spartacus的推荐方法是构建自己的JavaScript web应用程序并导入库。无需修改,店面就能开箱工作,但 Spartacus 被设计为可升级、可定制和可扩展的,以满足您所有的品牌和功能需求。
入口:occ-product.adapter.ts~loadMany 方法:

拼装 url 输入参数就是:productCode 这个键值对,参数名称为 productCode,值为实际的产品 code,比如 358639:

同时,product 数据请求的 url,根据 productCode 值(动态),插入一个字符串模板构成的,这个字符串模板实际就是 product API 的 endpoint, 定义在 this.config.backend.occ.endpoints 里。下图是 product 相关的 OCC API endpoint:

上图配置的数据源,实际上硬编码在这个文件 projects\core\src\occ\adapters\product\default-occ-product-config.ts 里:

从调试器里能看出,Spartacus home 页面发起的 product 数据请求,scope 为 list,
故 url pattern 从 list 这个记录里取出,${productCode} 在运行时会被其实际值 358639 替换。

最后就成了下图:
为了保持我们对可升级性的承诺,Spartacus的设计模式是将非核心特性构建为添加或更改所提供功能的特性库(feature libraries)。
在使用Spartacus时,需要构建一个应用程序,它将引入Spartacus库,其中包含使用SAP Commerce Cloud所需的核心资源。然后构建包含任何自定义功能和页面的新特性。
Spartacus页面的内容是从SAP Commerce Cloud CMS(内容管理系统)获取的,比如徽标、链接、横幅和静态页面。SAP 建议新的内容驱动特性遵循相同的模式,使Content manager能够通过CMS工具修改页面内容。
边栏推荐
- Leetcode 44 Wildcard matching (2022.02.13)
- MySQL functions
- Data analysis thinking analysis methods and business knowledge -- analysis methods (II)
- Key structure of ffmpeg - avformatcontext
- Spark DF adds a column
- Classical concurrency problem: the dining problem of philosophers
- anconda下载+添加清华+tensorflow 安装+No module named ‘tensorflow‘+KernelRestarter: restart failed,内核重启失败
- Room cannot create an SQLite connection to verify the queries
- Spark DF增加一列
- Spark AQE
猜你喜欢

Extension and application of timestamp

数据分析思维分析方法和业务知识——分析方法(三)

Arduino六足机器人

Mysql - CRUD

Spark AQE

Spark SQL空值Null,NaN判断和处理

How to solve the problems caused by the import process of ecology9.0

Basic introduction and source code analysis of webrtc threads

LeetCode 1598. Folder operation log collector

Idea远程提交spark任务到yarn集群
随机推荐
uniapp开发,打包成H5部署到服务器
Spark SQL UDF function
AtCoder Beginner Contest 254【VP记录】
SQLServer连接数据库读取中文乱码问题解决
MDK debug时设置数据实时更新
[groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)
FFT learning notes (I think it is detailed)
anconda下载+添加清华+tensorflow 安装+No module named ‘tensorflow‘+KernelRestarter: restart failed,内核重启失败
notepad++正则表达式替换字符串
[designmode] adapter pattern
Intranet Security Learning (V) -- domain horizontal: SPN & RDP & Cobalt strike
MYSQL GROUP_ The concat function realizes the content merging of the same ID
[Online gadgets] a collection of online gadgets that will be used in the development process
Global and Chinese market of valve institutions 2022-2028: Research Report on technology, participants, trends, market size and share
Classical concurrency problem: the dining problem of philosophers
[groovy] compile time metaprogramming (compile time method interception | find the method to be intercepted in the myasttransformation visit method)
notepad++正則錶達式替換字符串
How spark gets columns in dataframe --column, $, column, apply
Pointer - character pointer
《编程之美》读书笔记