当前位置:网站首页>The population logic of the request to read product data on the sap Spartacus home page

The population logic of the request to read product data on the sap Spartacus home page

2022-07-06 00:45:00 Wang Zixi

Spartacus It's an open source JavaScript web Applications , Allows you to quickly create your own based on JavaScript Of SAP Business cloud store .Spartacus Yes, it is Angular Compiling , And publish in the form of Library . Use Spartacus The recommended method is to build your own JavaScript web Import and store the application . There is no need to modify , The storefront can open the box and work , but Spartacus Designed to be upgradeable 、 Customizable and extensible , To meet all your brand and functional needs .

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

assemble url The input parameter is :productCode This key is right , The parameter name is productCode, The value is the actual product code, such as 358639:

meanwhile ,product Data requested url, according to productCode value ( dynamic ), Insert a string template , This string template is actually product API Of endpoint, It's defined in this.config.backend.occ.endpoints in . The picture below is product dependent OCC API endpoint:

The data source configured in the figure above , Actually hard coded in this file projects\core\src\occ\adapters\product\default-occ-product-config.ts in :

You can see from the debugger ,Spartacus home Page initiated product Data request ,scope by list,

so url pattern from list From this record ,${productCode} At run time, the actual value will be 358639 Replace .

Finally, it becomes the following figure :

In order to maintain our commitment to scalability ,Spartacus The design pattern of is to build non core features into feature libraries that add or change the functions provided (feature libraries).

In the use of Spartacus when , You need to build an application , It will introduce Spartacus library , It includes the use of SAP Commerce Cloud Core resources needed . Then build new features that include any custom functions and pages .

Spartacus The content of the page is from SAP Commerce Cloud CMS( Content management system ) Acquired , Like logos 、 link 、 Banners and static pages .SAP It is suggested that the new content driven features follow the same pattern , send Content manager Can pass CMS Tools modify page content .

原网站

版权声明
本文为[Wang Zixi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060035257171.html