https://github.com/SAP/spartacus-docs/blob/901d0521dcf4668e2ddc5982947268becd0e66dd/_pages/dev/context-configuration.md

每个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/

SAP Spartacus的site context配置相关推荐

  1. SAP Spartacus的site context配置参数SiteContextParamsService

    clone request之前: "https://jerry.eastus.cloudapp.azure.com:9002/occ/v2/electronics-spa/cms/pages ...

  2. SAP Spartacus B2B table的配置信息的merge原理

    以SAP Spartacus b2b unit table的配置信息为例:位于文件units.config.ts里: 运行时,这些配置信息,被merge在table.service.ts的this.c ...

  3. SAP Spartacus powertools-spa site在Commerce Cloud后台的属性

    这个site的前台界面: 该site的base store为powertools,catalog为Powertools product catalog: site channel,B2B 或者 B2C ...

  4. SAP Spartacus B2B table的配置信息从哪里来?

    运行时的table配置: 实现位于table.config.ts里: 以unit table为例,配置的实现在units.config.ts文件里: 运行时的效果: 更多Jerry的原创文章,尽在:& ...

  5. SAP Spartacus ConfigurationService

    位于文件configuration.service.ts内: import { Inject, Injectable, OnDestroy } from '@angular/core'; import ...

  6. 如何在 SAP Spartacus 里添加自定义页面 - Custom Page

    网友提问 Add a custom page to Spartacus I would like to add a custom sub page (http://localhost:4200/ima ...

  7. SAP Spartacus 的路由配置

    Configurable Routing 在单页应用程序中,您可以通过显示应用程序的不同视图来控制用户看到的内容. Spartacus 使用 Angular Router 来处理从一个视图到另一个视图 ...

  8. user.config.ts文件里定义的配置是如何合并到SAP Spartacus的标准配置里去的

    user.config.ts文件里提供的默认配置: userRoutingConfig userCmsConfig userTableConfigFactory - function provideD ...

  9. SAP Spartacus配置后台Commerce Cloud的位置

    SAP Spartacus需要连接后台Commerce Cloud才能工作: Access to XMLHttpRequest at 'https://spartacus-dev0.eastus.cl ...

最新文章

  1. 修改Tomcat可支持get传参方式的url长度,get形式
  2. 芝麻信用_别忘查看支付宝芝麻信用分,这些特权别浪费
  3. php试卷A高质量含答案,php试卷A高质量含答案
  4. axios请求本地的json文件在打包部署到子目录域名下,路径找不到
  5. 素数个数(信息学奥赛一本通-T1151)
  6. bz2005 2005: [Noi2010]能量采集 数学题
  7. 0编译器详解_C++ typeid关键字详解
  8. 【面经】我是如何优雅的跳槽的?
  9. 华为5500v3多路径linux6,CentOS7 DM-Multipath+HUAWEI OceanStor存储多路径配置
  10. 蒙特卡洛之布丰投针(python实现)
  11. CA认证过程及https实现方法
  12. 我的世界服务器怎么无限刷红石,我的世界:生存最需要的5个红石机器!MC大神才能看懂这操作!...
  13. win7 64位下如何安装配置mysql
  14. T-test数据分析
  15. 酒桌上的潜规则,男人必学,女人必知
  16. CSS中Border(边框)
  17. 计算机网络原理夏秦课后答案,案例-大学计算机基础西安交通大学.doc
  18. SpringBoot2.x 自动化生成代码整合Mybatis
  19. 天正引出标注lisp_CAD中怎么画引出标注?
  20. 请更换备份电池 pos机_POS机常见问题及处理方法

热门文章

  1. OPGL+GLFW+GLEW配置详细步骤
  2. stm32F1和stm32F4的区别
  3. 小程序 页面禁止左右上下滑动
  4. UPC2018组队训练赛第六场
  5. bzoj1096 [ZJOI2007]仓库建设
  6. [acm]HDOJ 1200 To and Fro
  7. 《疯狂Java讲义精粹》读书笔记2 ------ 多态
  8. matlab设置随机流的种子
  9. 使用dbghelp获取调用堆栈--release下的调试方法学
  10. 0327 ARM 裸奔学习总结