头图

Spartacus is an open-source JavaScript web application that allows you to quickly create your own JavaScript-based SAP Commerce Cloud storefront. Spartacus is written in Angular and released as a library. The recommended way to use Spartacus is to build your own JavaScript web application and import the library. The storefront works out of the box without modification, but Spartacus is designed to be upgradable, customizable and extensible to meet all your branding and functional needs.

Entry: occ-product.adapter.ts~loadMany Method:

The input parameter of the assembly url is: productCode this key-value pair, the parameter name is productCode, and the value is the actual product code, such as 358639:

At the same time, the url of the product data request is formed by inserting a string template according to the productCode value (dynamic). This string template is actually the endpoint of the product API, which is defined in this.config.backend.occ.endpoints. The following figure is the product related OCC API endpoint:

The data source configured in the above figure is actually hardcoded in this file projects\core\src\occ\adapters\product\default-occ-product-config.ts :

It can be seen from the debugger that the product data request initiated by the Spartacus home page, the scope is list,

Therefore, the url pattern is taken from the record list e7dabfd320c8a93b81c530fcedb28c6d---, and ${productCode} will be replaced by its actual value 358639 --- at runtime.

In the end it becomes the following image:

In keeping with our commitment to upgradability, the Spartacus design pattern is to build non-core features as feature libraries that add or change the functionality provided.

When using Spartacus, you need to build an application that will pull in the Spartacus library, which contains the core resources required to use SAP Commerce Cloud. Then build new features that include any custom features and pages.

The content of Spartacus pages is obtained from SAP Commerce Cloud CMS (Content Management System), such as logos, links, banners and static pages. SAP recommends that new content-driven features follow the same pattern, enabling content managers to modify page content through CMS tools.


注销
1k 声望1.6k 粉丝

invalid