プロダクトバンドルレンダリングのカスタマイズ

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

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

デフォルトの製品バンドルレンダリングには 、Scribanテンプレートという形のレンダリングバリアントが含まれています。デフォルトのProduct Bundleレンダリングは、静的バンドルと動的 バンドルの両方を扱います。元のレンダリングバリアントに含まれていたすべてのネストされたアイテムは、単一のScribanテンプレートに統合されます。Scribanテンプレートを修正することもできますが、ソフトウェアのアップグレード時にカスタマイズが上書きされないように、新しいカスタムレンダリングバリアントを作成するのが最善です。例えば カスタムラベルを追加するなどテンプレートを簡単に変更できるため、Scribanテンプレートは非常にカスタマイズ性と拡張性が高いです。レンダリング時の ラベルも変更 可能です。

!注Product Bundleの廃止レンダリングは既存サイトでのみ利用可能で、レンダリングバリアントのScribanテンプレートではなくMVCビューに基づいています。

Product Bundleレンダリングバリアントは独自のデフォルトレンダリングバリアントルート とデフォルトレンダリングバリアント (/sitecore/Content///Presentation/Rendering Variants/Product Bundle)を持っています。マークアップ生成にはScribanテンプレート、AJAXリクエストとして株価情報の取得にはScribanテンプレート、JavaScriptはAJAXリクエストとして取得し、ラベル翻訳にはSXA辞書を使用します。

以下のコードは、デフォルトのレンダリングバリアント内で定義されたProduct BundleレンダリングScribanテンプレートを示しています。カタログ名とバンドルIDはMVCコントローラーに渡され、対応するバンドルリポジトリを使ってモデルを埋める責任があります。モデルはビューに渡され、レンダリングバリアントや埋め込みアイテムo_model(the-embedded-commerce-items-and-objects-for-scriban-templates.md "The embedded Commerce items and objects for Scriban templates")を用いるScribanテンプレートで利用可能です。モデルは、オプションのバンドルアイテムやアップグレード可能なアイテムを含む、製品バンドルをレンダリングするために必要なすべてのオブジェクトと値を公開します。

{{ # The

element contains the bundle data attributes with the values populated from the data model and data source. }}

{{ # The

element displays the bundle title text retrieved from the data source. }}

{{ i\_datasource.TitleText }}

{{ # The
element contains all the bundle line items. }}
{{ # Iterate through each bundle line item. }} {{ for bundleLineItem in o\_model.line\_items }} {{ ## The
element contains the bundle data attributes with the values populated from the bundle line item. The 'noPanel' CSS class will be applied if the 'hasPanel' computed property in the view model returns false. ## }} {{ # The
element contains all the header elements. }}
{{ # The
element has a binding with the click event to show or hide its content. }}
{{ ## The element displays the bundle line item summary in this format: Example: Habitat Dwell Digital Wifi Scale (Black) - 2 pcs ## }} {{ ## The element displays the display name of the bundle line item. It has a text binding with the bundleLineItemName observable to ensure the value is updated in the case when an upgrade item is selected. ## }} {{ bundleLineItem.display\_name }} {{ # The element displays the separator. }} - {{ ## The element displays the quantity of the bundle line item. It has a text binding with the bundleLineItemQuantity observable to ensure the value is updated in the case when an upgrade item is selected. ## }} {{ bundleLineItem.quantity }} {{ # The element displays the unit of measurement retrieved from the data source. }} {{ i\_datasource.UnitOfMeasurement }} {{ # The setArrowClass computed property in the view model determines whether to display the accordion toggle button. }} {{ ## The element is a link to the product page of the bundle line item. Link text is retrieved from the data source. It has a href attribute binding with the bundleLineItemLink observable to ensure the value is updated in the case when an upgrade item is selected. ## }} {{ i\_datasource.ViewProductText }}
{{ ## The
element has a visible binding with the bundle line item 'is\_optional' flag. Hence, it will only be displayed if the flag is true. ## }}
{{ ## The element is a checkbox with a checked binding to indicate whether the bundle line item is included in the bundle or not. The element is disabled if the computed property 'isCheckboxDisabled' returns true. ## }} {{ # The
{{ ## The
element contain all elements to display and modify the bundle line item quantity. It has a visible binding with the 'is\_dynamic\_bundle' flag in the model. Hence, it will only be displayed if the flag is true. ## }}
{{ # The
この記事を改善するための提案がある場合は、 お知らせください!