日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SAP Commerce SmartEdit 如何同 SAP Spartacus 协同工作

發(fā)布時(shí)間:2023/12/19 编程问答 58 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SAP Commerce SmartEdit 如何同 SAP Spartacus 协同工作 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

將Commerce Cloud里下列文件拷貝到Angular應(yīng)用的src文件夾里:

hybris/bin/modules/smartedit/smarteditaddon/acceleratoraddon/web/webroot/_ui/shared/common/js/webApplicationInjector.js

編輯Angular項(xiàng)目的angular.json, 把SmartEdit的webApplicationInjector.js添加進(jìn)去:

"architect": { "build": {"builder": "@angular-devkit/build-angular:browser","options": {"outputPath": "dist/mystore","index": "src/index.html","main": "src/main.ts","polyfills": "src/polyfills.ts","tsConfig": "src/tsconfig.app.json","assets": ["src/favicon.ico","src/assets","src/webApplicationInjector.js"],...

編輯src/index.html文件的HEAD區(qū)域:

添加下面一行:

<script id="smartedit-injector" src="webApplicationInjector.js" data-smartedit-allow-origin="localhost:9002"></script>

Replace localhost:9002 with the domain of your server.
This line tells SmartEdit that Spartacus is allowed to be edited by SmartEdit.

上面一行代碼,語義上是告訴SmartEdit,Spartacus允許其頁面被SmartEdit編輯。

以Administrator登錄SmartEdit,點(diǎn)擊右上角的Settings超鏈接,向下滾動(dòng)whiteListedStorefronts,將Spartacus Storefront的鏈接添加進(jìn)去:

["https://localhost:4200"]

在SmartEdit里以preview方式打開Spartacus頁面時(shí),SmartEdit會(huì)發(fā)送如下包含了cmsTicketId的參數(shù)給Spartacus:

https://localhost:4200/cx-preview?cmsTicketId=6477500489900224fda62f41-167a-40fe-9ecc-39019a64ebb9

cx-preview path代表以preview模式打開Spartacus.

cmsTicketId is generated in SAP Commerce Cloud backend. It contains many information required by SmartEdit, such as site-id or catalogVersion.

包含了site-id / catalogVersion信息。

To make SmartEdit be able to load pages in Spartacus, it needs to get all the required context data, which includes site, content catalog, and content catalog version, and can also be for a specified language, or date and time. Therefore, cmsTicketId needs to be appended to any CMS requests sent from Spartacus to backend.

SmartEdit加載Spartacus的頁面,而后者元數(shù)據(jù)來自backend,因此經(jīng)由Spartacus發(fā)送到backend的請求也需要附上cmsTicketId.

Spartacus里有個(gè)CmsTicketInterceptor, 負(fù)責(zé)動(dòng)態(tài)添加cmsTicketId參數(shù)。

In Spartacus, we have CmsTicketInterceptor. If cmsTicketId exists and requests are cms specified, it adds cmsTicketId as one of the request parameters.

https://localhost:9002/rest/v2/electronics-spa/cms/pages?fields=DEFAULT&lang=en&curr=USD&cmsTicketId=6477500489900224fda62f41-167a-40fe-9ecc-39019a64ebb9

一旦SAP Commerce Cloud后臺收到包含cmsTicketId的請求,其響應(yīng)結(jié)構(gòu)里包含properties字段:

... "label" : "homepage", "properties" : {"smartedit" : {"classes" : "smartedit-page-uid-homepage smartedit-page-uuid-eyJpdGVtSWQiOiJob21lcGFnZSIsImNhdGFsb2dJZCI6ImVsZWN0cm9uaWNzLXNwYUNvbnRlbnRDYXRhbG9nIiwiY2F0YWxvZ1ZlcnNpb24iOiJTdGFnZWQifQ== smartedit-catalog-version-uuid-electronics-spaContentCatalog/Staged"}} }

In the group smartedit, there is classes. It is the required SmartEdit contract for this CMS page. So, we need add these “classes” into the class list of the html body tag. If you check the html page source, you will see the body tag has the “classes”.

如下代碼所示:

<body class="smartedit-page-uid-homepage smartedit-page-uuid-eyJpdGVtSWQiOiJob21lcGFnZSIsImNhdGFsb2dJZCI6ImVsZWN0cm9uaWNzLXNwYUNvbnRlbnRDYXRhbG9nIiwiY2F0YWxvZ1ZlcnNpb24iOiJTdGFnZWQifQ== smartedit-catalog-version-uuid-electronics-spaContentCatalog/Staged"><cx-storefront ng-version="8.0.0" class="stop-navigating"><header><cx-page-layout section="header" ng-reflect-section="header" class="header"><!--bindings={ ...

默認(rèn)的預(yù)覽Category/Product

Each site has defaultPreviewCategory, defaultPreviewProduct and defaultPreviewCatalog. For example:

UPDATE CMSSite;uid[unique=true];defaultPreviewCategory(code, $productCV);defaultPreviewProduct(code, $productCV);defaultPreviewCatalog(id) ;$spaSiteUid;575;2053367;$productCatalog

When open category or product pages in SmartEdit, you will find that not only the CMS pages are loaded, the default preview product/category is also loaded.

In SmartEdit, product with code 2053367 is opened in the product details page:

在SmartEdit預(yù)覽Spartacus頁面時(shí),這些默認(rèn)的產(chǎn)品 / Category就派上用場了:

Same for the category page, category 575 is opened in the product list page:

更多Jerry的原創(chuàng)文章,盡在:“汪子熙”:

總結(jié)

以上是生活随笔為你收集整理的SAP Commerce SmartEdit 如何同 SAP Spartacus 协同工作的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 奇米影视77777 | 欧美成人免费观看 | 凹凸日日摸日日碰夜夜 | 色成人综合网 | av五十路| 四川丰满妇女毛片四川话 | 亚洲精选久久 | 久久久噜噜噜www成人网 | 新x8x8拨牐拨牐永久免费影库 | 91精品国产电影 | 国产精品亚洲一区二区三区在线观看 | 偷操 | 国产曰肥老太婆无遮挡 | 色婷婷九月 | 污网站在线免费看 | 自拍偷拍电影 | 在线观看黄色大片 | 日韩午夜在线观看 | 偷拍亚洲另类 | 二色av| 成人免费一级片 | 456av| 精品免费视频 | 亚洲中文字幕久久无码 | 久久久久久无码午夜精品直播 | 国产精品婷婷 | 天天干,天天操 | 黄色三级免费观看 | 成人天堂噜噜噜 | 在线观看色网 | 欧美人与性禽动交精品 | 国产一区二区精品在线 | 婷婷在线免费观看 | 男女爱爱动态图 | 精品少妇一区二区三区 | 成人av动漫 | 91精品一区二区三区综合在线爱 | 中文字幕手机在线视频 | 台湾swag在线播放 | 亚洲欧美在线观看 | 99免费在线观看 | 欧美激情一区二区三区p站 欧美mv日韩mv国产网站app | 亚洲第一欧美 | 大胸喷奶水www视频妖精网站 | 欧美视频色| 精品裸体舞一区二区三区 | 欧美视频一区二区三区 | 国内露脸中年夫妇交换 | 欧美成人免费网站 | av黄在线| 亚洲熟女综合色一区二区三区 | 黄色片视频网站 | 欧亚一级片 | 欧美一级久久久 | 校园春色亚洲激情 | 国产农村乱对白刺激视频 | 波多野吉衣在线观看视频 | 国产乱码精品一区二区三区五月婷 | 日韩性爰视频 | 天天操天天干天天干 | 雪白的扔子视频大全在线观看 | 国产又粗又猛又黄又爽 | 欧美亚洲国产另类 | 99国产精品久久久久久久成人 | 国产成人+综合亚洲+天堂 | 哺乳期av | 久久久久久久久久久综合 | 在线观看国产精品入口男同 | 色污网站 | 青草视频在线看 | 哪里可以看毛片 | 欧美一级大片在线观看 | 9999免费视频 | 中文字幕日韩视频 | 亚洲美女av在线 | 黄色69视频| 亚洲精品在线电影 | 欧美交受高潮1 | 精品91久久久久久 | 国产乱子伦精品无码专区 | 国产一级久久久久毛片精品 | 欧美色爽 | 无码人妻精品一区二区蜜桃视频 | 亚洲GV成人无码久久精品 | 特级做a爰片毛片免费69 | 欧美日韩一级黄色片 | 亚洲欧美日韩国产精品 | 男女啪啪免费网站 | 97狠狠| 男生女生搞黄色 | 亚洲黄色在线观看 | 亚洲激情第一页 | 玖玖综合网 | 亚洲激情免费 | 一级免费黄色 | 亚洲免费a视频 | 成人男女视频 | 精品一区二区免费 | 在线播放小视频 |