- SAP Spartacus的site context配置
- Angular InjectionToken APP_INITI
- SAP Spartacus的site context配置参数Si
- SAP Spartacus Site Context 实现专题页
- 自定义SAP Spartacus的产品搜索API参数
- SAP 电商云 Spartacus UI 产品明细页面路由路径的
- SAP 电商云 Spartacus UI 里如何捕捉语言设置的更
- SAP 电商云 Spartacus UI External Ro
- 让 fork 出来的 Github 仓库从远端仓库拖取最新的修改
- SAP 电商云 Spartacus UI 和 CPQ Confi
每个CMS site都有一个自己的上下文:
- base site ID,
- allowed languages and default language,
- allowed currencies and default currency.
- configuration of persistence of above attributes in the URL
静态上下文配置
You can configure your application by defining context properties, such as base site, language, and currency. When you append the values of these properties to the storefront URL, the storefront is configured based on these values.
配置代码如下:
export const b2cFeature: FeatureEnvironment = {
imports: [
B2cStorefrontModule.withConfig({
context: {
urlParameters: ['baseSite', 'language', 'currency'],
baseSite: [
'electronics-spa',
'electronics',
'apparel-de',
'apparel-uk',
'apparel-uk-spa',
],
},
For example, when you access https://localhost:4200/electronics-spa/en/USD/, the application loads the electronics-spa base site, sets the site language to English (en), and sets the currency to US dollars (USD).
The context properties also set the default values for the language and currency drop-down lists, which you can use to change the context of the storefront dynamically.
Context属性在app.module.ts里定义:
context: {
baseSite: ['electronics-spa'],
urlParameters: ['baseSite', 'language', 'currency']
},

urlparameter的顺序可以自己调:
context: {
baseSite: [
'electronics-spa', //Selected by default because it is the first element in the list
'electronics',
],
language: [
'en'
],
currency: [
'USD'
],
urlParameters: ['baseSite', 'language', 'currency']
},
You can change the structure of the context in the URL by changing the order of the elements in the urlParameters property. For example, if you change the urlParameters property to urlParameters: ['currency', 'language', 'baseSite'], then the URL becomes https://localhost:4200/USD/en/electronics-spa/
网友评论