オーダーラインレンダリングのカスタマイズ
このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。
Order LinesレンダリングにはScribanテンプレートというレンダリングバリアントが含まれています。Order Linesレンダリングには独自のデフォルトレンダリングバリアントrootとデフォルトレンダリングバリアント(/sitecore/Content///Presentation/Rendering Variants/Order Lines)があり、マークアップを生成するためにScribanテンプレートを使用します。Scribanテンプレートを変更することは可能ですが、ソフトウェアのアップグレード時にカスタマイズが上書きされないように、新しいカスタムレンダリングバリアントを作成するのが最善です。レンダリングのラベルを変更することも可能です。
!note The Order Lines - 廃止されたレンダリングは既存サイトのみで利用可能で、レンダリングバリアントのScribanテンプレートではなくMVCビューに基づいています。
以下のコードは、デフォルトのレンダリングバリアント内で定義されたOrder LinesレンダリングのScribanテンプレートを示しています。製品名、バリアント情報、納品情報はMVCモデルに渡され、レンダリングバリアントや埋め込みアイテムo_model(/xp/en/developers/sxa/100/sitecore-experience-accelerator/en/the-embedded-functions-for-the-scriban-template.html)を用いるScribanテンプレートで利用可能です。
{{ # Error message area }} {{if o_model.error_message}}
{{ # If there is no error, order lines will be rendered }} {{ else }}
{{ sc\_field i\_datasource "Order Lines Header Label" }}
{{ # Order lines header, contains the column titles }}
{{ # Order lines body, the following
{{ orderLine.product\_display\_name }}
{{ # The following
{{ # The following
contains the delivery method information }} {{ if orderLine.shipping_method_name }}
{{ sc\_field i\_datasource "Order Lines Delivery Label" }}: {{ orderLine.shipping\_method\_name }}
{{ end }}{{ # The following
- {{ orderLine.address.address1 }}, {{ orderLine.address.city }}
- {{ orderLine.address.state }}, {{ orderLine.address.zip\_postal\_code }}, {{ orderLine.address.country }}
{{ # The following
contains the electronic delivery email address information }} {{ if orderLine.electronic_delivery_email }}
{{ orderLine.electronic\_delivery\_email }}
{{ end }} {{ end }}{{ # The following
{{ # The following
{{ # The following
{{ orderLine.total\_text }}
{{ # If the order line is free gift, show the original price, otherwise show the discount }}
{{ if orderLine.is\_free\_gift }}
{{ orderLine.price\_text }}
{{ else if orderLine.line\_discount > 0 }}
{{ sc\_field i\_datasource "Order Lines Discount Label" }}
{{ orderLine.line\_discount\_text }}
{{ end }}
{{ subLine.product\_display\_name }}
順序線レンダリングモデル
Order Lines Scribanテンプレートでは、埋め込みアイテムo_modelを通じてOrderlinesRenderingModelモデルに含まれるプロパティやオブジェクトにアクセスできます。Order Linesレンダリングモデルは以下の図に示されています。
