無料ギフトセレクションレンダリングのカスタマイズ

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

Free Gift Selectレンダリングには、Scribanテンプレートというレンダリングバリアントが含まれています。Free Gift Selectionレンダリングには独自のデフォルトのレンダリングバリアントrootとデフォルトレンダリングバリアント(/sitecore/Content///Presentation/Rendering Variants/Free Gift Selection)があり、Scribanテンプレートを使ってマークアップを生成し、ClaimギフトボタンをクリックするとAdd-to-cartイベントをトリガーするためにCDにAJAX呼びかけを行います。Free giftはAPIを使ってカートラインに追加され、IsFreeGiftプロパティはtrueに設定されています。

Scribanテンプレートを変更することもできますが、ソフトウェアのアップグレード時にカスタマイズが上書きされないように、新しいカスタムレンダリングバリアントを作成するのが最善です。レンダリングの ラベルを変更する ことも可能です。

以下のコードは、デフォルトのレンダリングバリアント内で定義された無料ギフト選択レンダリングのScribanテンプレートを示しています。買い物客が無料ギフトを選べる販売可能なアイテムのリストは、埋め込まれたアイテムo_model(the-embedded-commerce-items-and-objects-for-scriban-templates.md "The embedded Commerce items and objects for Scriban templates")を使ってScribanテンプレートに渡されます。

{{ # The hidden

element contains serialized data in JSON format. }}

{{ ## The hidden

element contains texts related to the component. These values are populated from data model and datasource. ## }}

{{ # The

element shows a list of multiple free gift selections based on various qualifications. }}

{{ ## The

element displays the selected free gift that has been chosen and the maximum number of free gifts that a shopper can choose from the free gift selection. ## }}

{{ sc\_field i\_datasource 'Free Gift Chosen Text' }} {{ sc\_field i\_datasource 'Free Gift Selection Text' }}

{{ # The

element contains a checkbox, product image, display name, description, stock status, variant combinations for each free gift. }}

{{ # The

element displays each item as free gift selection in the list populated from data model. }}

{{ # The

element shows whether a free gift is already included in the free gift selection. }}

{{ # The
element display product image. }} {{ # The
element displays product display name, description, valid variant combinations. }}

{{ # The

element displays the variant combination when there is only one valid variant combination. }}

{{ # The element displays the variant name. }} : {{ # The element displays the variant value. }}
{{ # The
element contains the selections for variant properties. }}
{{ # The
{{ # The
element displays stock status of the free gift. }}
{{ # The
element displays the sale and list prices of the free gift. }}
{{ # The
element contains the button to claim the free gift. The text of the button is populated from the datasource. }}

フリーギフトセレクションレンダリングモデル

無料ギフトセレクションのScribanテンプレートでは、埋め込みアイテムo_model(/xp/en/developers/sxa/100/sitecore-experience-accelerator/en/the-embedded-items-and-objects-in-the-scriban-context.html)を通じてFreeGiftSelectionRenderingModelモデルに含まれるプロパティやオブジェクトにアクセスできます。以下の図に示されています。

Diagram of the Free Gift Selection rendering model

無料ギフトセレクションのコールシーケンス

以下のシーケンス図は、買い物客が無料ギフトを選択し、請求した際にかけられる通話の概要を示しています。最新のカート情報を取得するために使われる通話は1回のみで、購入者が変更を加えるたびに無料ギフト選択レンダリングが自動的に更新されます。

Free Gift Selection sequence diagram
この記事を改善するための提案がある場合は、 お知らせください!