Promotions Entity Views and Actions API(C#)を使って作業してください
このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。
外部システムはSitecore XCプロモーション関連の運用を統合し、Sitecore XCプロモーションエンティティビューおよびアクションAPIを用いて他のシステムとプロモーション関連データを交換できます。
コンテナコール内にはCommerce Engineの操作やコマンド(C#を使用)を含める必要があります(この 例参照)。
Sitecore Experience Commerce(XC)システムでいかなる操作を実行するにも、呼び出し先はSitecore Identity Serverの 有効なベアラー認証トークンを取得する 必要があります。
プロモーションビューとアクションAPIは、プロモーション書籍の行動Add、Get、Edit 、Manage Associated Catalogsをサポートしています。
!注ビューズ&アクションAPIは、ビジネスユーザーインターフェースに対応するために設計された オーサリングAPIであり、統合シナリオには最適化されていません。
Views and Actions APIをコマース統合で使用する際には、以下の点を考慮する必要があります。
Views and Actions APIは一度に1つのCommerceエンティティしか処理できず、バッチ処理はサポートしていません。
Views and Actions APIはCommerce WebサービスのAPIよりも多くのオーバーヘッドを伴います。Views and Action APIの呼び出しは通常3ステップで、アクションのビューを取得し、ビューのプロパティを更新した値で修正し、アクションを実行します。
プロモーションブック(C#)を追加
APIリクエストを使ってプログラム的に新しいプロモーションブックを作成できます。一度プロモーションブックが存在すると、その名前を変更することはできません。プロモーションブックを削除することもできません。
C#を使ってプロモーションブックを追加するには:
-
エンティティビューを入手:
DataServiceQuerySingle
query = container.GetEntityView(string.Empty, "Details", "AddPromotionBook", string.Empty); EntityView view = Proxy.GetValue(query); -
ビューのプロパティをName、DisplayName 、Descriptionを指定することで修正します。例えば:
var nameProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Name")); nameProperty.Value = "MyPromotionBook"; var displayNameProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName")); displayNameProperty.Value = "Book Display Name"; var descriptionProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Description")); descriptionProperty.Value = "Book Description";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
プロモーションブック(C#)から閲覧数を獲得する
Views APIを使って 、プロモーションブックの異なるビューを取得することができます。
!注ビューズAPIは コンポジットエンティティビューを使用しています。マスタービューをリクエストできますが、子ビューもリクエストできます。
プロモーションのブックマスタービューを取得
プロモーションのブックマスタービューを取得するには:
DataServiceActionQuerySingle
プロモーションブックの詳細を見る
プロモーションブックの詳細を見るには以下をご覧ください:
query = container.GetEntityView($"Entity-PromotionBook-{bookFriendlyId}", "Details", string.Empty, string.Empty); view = Proxy.GetValue(query);
プロモーションブックの関連カタログビューを取得
プロモーションブックの関連カタログを取得するには、以下をご覧ください:
query = container.GetEntityView($"Entity-PromotionBook-{bookFriendlyId}", "PromotionBookCatalogs", string.Empty, string.Empty); view = Proxy.GetValue(query);
プロモーションブックのプロモーションビューを取得
プロモーションブックの見解を得るには:
query = container.GetEntityView($"Entity-PromotionBook-{bookFriendlyId}", "Promotions", string.Empty, string.Empty); view = Proxy.GetValue(query);
昇進帳(C#)を編集する
既存のプロモーションブックのDisplayNameやDescriptionプロパティの値は変更できます。ただし、内部名( Nameプロパティの値)は変更できません。リクエストで値が指定されていなければ、既存の値は変更されません。
プロモーション帳の詳細を編集するには:
-
エンティティビューを入手:
DataServiceQuerySingle
query = container.GetEntityView($"Entity-PromotionBook-{bookFriendlyId}", "Details", "EditPromotionBook", string.Empty); EntityView view = Proxy.GetValue(query); -
例えば、DisplayNameやDescription、またはその両方を指定することでビューのプロパティを修正できます。以下の例で示されています。
var displayNameProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName")); displayNameProperty.Value = "Edited Book Display Name"; var descriptionProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Description")); CommerceCommand command = Proxy.DoCommand(container.DoAction(view));descriptionProperty.Value = "Edited Book Description";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
カタログとプロモーションブック(C#)を関連付けましょう
カタログをプロモーションに関連付けて、本で定義されたプロモーションがカタログ商品に適用できるようにします。プロモーションブックを複数のカタログに関連付けることはできますが、カタログは1冊のプロモーションブックにしか関連付けられません。
カタログとプロモーションブックを関連付ける場合:
-
エンティティビューを入手:
DataServiceQuerySingle
query = container.GetEntityView($"Entity-PromotionBook-{bookFriendlyId}", string.Empty, "DisassociateCatalog", string.Empty); EntityView view = Proxy.GetValue(query); -
例えば、関連付けたいカタログを指定するためにビュープロパティを修正します。
view.ItemId = "MyCatalog";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
昇進を追加(C#)
プロモーションブック内でプロモーションを作成します。プロモーションブック内で、プロモーション名は一意でなければなりません。プロモーションの名前を変更することはできません。
昇進を追加するには:
-
エンティティビューを入手:
DataServiceQuerySingle
query = container.GetEntityView($"Entity-PromotionBook-{bookFriendlyId}", "Details", "AddPromotion", string.Empty); EntityView view = Proxy.GetValue(query); -
ビューのプロパティを修正してプロモーションの詳細を指定することができます。例えば:
var nameProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Name")); nameProperty.Value = "MyPromotion"; var displayNameProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName")); displayNameProperty.Value = "Promotion Display Name"; var descriptionProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Description")); descriptionProperty.Value = "Promotion Description"; var displayTextProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayText")); displayTextProperty.Value = "Promotion Text"; var displayCartTextProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayCartText")); displayCartTextProperty.Value = "Promotion Cart Text"; var validFromProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("ValidFrom")); validFromProperty.Value = DateTimeOffset.UtcNow.ToString(CultureInfo.InvariantCulture); var validToProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("ValidTo")); validToProperty.Value = DateTimeOffset.UtcNow.AddDays(30).ToString(CultureInfo.InvariantCulture); var isExclusiveProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("IsExclusive")); isExclusiveProperty.Value = "true";
-
行動を実行しろ
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
このリクエストは、PromotionAddedモデルの一部としてプロモーションのフレンドリー IDを返します。例えば:
PromotionAdded promotionAddedModel = command.Models.OfType
().FirstOrDefault(); string promotionFriendlyId = promotionAddedModel?.PromotionFriendlyId;
プロモーションの閲覧数(C#)
Views APIを使えば 、プロモーションの異なるビュー を取得することができます。
プロモーションのマスタービューを取得するには:
DataServiceActionQuerySingle
プロモーションの詳細を取得するには、以下をご覧ください:
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "Details", string.Empty, string.Empty); view = Proxy.GetValue(query);
昇進の資格取得方法は以下をご覧ください:
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "Qualifications", string.Empty, string.Empty); view = Proxy.GetValue(query);
プロモーションの特典情報を取得するには、こちらをご覧ください:
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "Items", string.Empty, string.Empty); view = Proxy.GetValue(query);
プロモーションのアイテムを取得するには以下をご覧ください:
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "Items", string.Empty, string.Empty); view = Proxy.GetValue(query);
プロモーションの公開クーポンの見解を取得するには:
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "PublicCoupons", string.Empty, string.Empty); view = Proxy.GetValue(query); view = Proxy.GetValue(query);
プロモーションのプライベートクーポンの見解を取得するには:
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "PrivateCoupons", string.Empty, string.Empty); view = Proxy.GetValue(query);
昇進を編集する(C#)
既存のプロモーションのプロパティの価値を変更できます。
!注昇進は、Aが州Draftにあった場合にのみ変更できます。
昇進を編集するには:
-
エンティティビューを入手:
DataServiceQuerySingle
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "Details", "EditPriceCard", string.Empty); EntityView view = Proxy.GetValue(query); -
必要に応じてビューのプロパティを修正します。例えば:
!注DisplayNameおよび/またはDescriptionの値を提供しない場合、現在の値は変更されません。その他のプロパティは必要です。( IsRequiredが "true"に設定されている場合、プロパティが必要です。
var displayNameProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName")); displayNameProperty.Value = "Edited Promotion Display Name"; var descriptionProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Description")); descriptionProperty.Value = "Edited Promotion Description"; var displayTextProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayText")); displayTextProperty.Value = "Edited Promotion Text"; var displayCartTextProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayCartText")); displayCartTextProperty.Value = "Edited Promotion Cart Text"; var validFromProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("ValidFrom")); validFromProperty.Value = DateTimeOffset.UtcNow.AddDays(3).ToString(CultureInfo.InvariantCulture); var validToProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("ValidTo")); validToProperty.Value = DateTimeOffset.UtcNow.AddDays(33).ToString(CultureInfo.InvariantCulture); var isExclusiveProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("IsExclusive")); isExclusiveProperty.Value = "false";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
限定を追加(C#)
資格とは、プロモーションの条件を設定し、その条件を満たすことで、プロモーション特典がショッパーズオーダーに適用されることを指します。Sitecore XCは、プロモーションに適用できる 複数の条件を提供しています 。
昇進に資格を追加するには:
-
例えば、エンティティビューを取得して「カートには[カウント]アイテム」を追加する?プロモーションの条件:
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, "QualificationDetails", "SelectQualification", string.Empty)); var conditionProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Condition")); var availableConditionsPolicy = conditionProperty.Policies.OfType
().FirstOrDefault(); conditionProperties.Value = availableConditionsPolicy?.List.FirstOrDefault(o => o.Name.Equals("CartHasItemsCountCondition")).Name; CommerceCommand command = Proxy.DoCommand(container.DoAction(view)); -
条件値を設定します。以下の例では、カートのアイテム 数は3に設定されています。
view = command.Models.OfType
().FirstOrDefault(v => v.Name.Equals(view.Name)); var countProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Count")); countProperty.Value = "3"; -
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
資格IDはQualificationAddedモデルで返されます。例えば:
var qualificationId = addAction.Models.OfType
().FirstOrDefault()?.QualificationId;
限定を編集する(C#)
既存の資格に変更はViews/Actions APIで行えます。
例えば、カートに[count] Items?を編集するには、countプロパティを5に設定して資格を付けます:
-
エンティティビューを入手:
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, "QualificationDetails", "EditQualification", qualificationId));
-
資格のプロパティ値を必要に応じて編集し、例えば「カートのアイテム数を5に変える」などの条件を変更できます。
var countProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Count")); countProperty.Value = "5";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
利点の追加(C#)
特典とは、プロモーションに適用される可能性のある割引のことです。特典は、プロモーションの適格条件が満たされた顧客の注文に適用されます。Sitecore XCは、1つのプロモーションに適用できる 特典を事前に定義しています 。1つのプロモーションに複数の特典を追加することも可能です。
プロモーションに特典を追加するには:
-
例えば、Get Cart Subtotal [特定] Amount Off特典をプロモーションに適用するためのエンティティビューを取得してください:
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, "BenefitDetails", "SelectBenefit", string.Empty)); var actionProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Action")); var availableActionsPolicy = actionProperty.Policies.OfType
().FirstOrDefault(); actionProperty.Value = availableActionsPolicy?.List.FirstOrDefault(o => o.Name.Equals("CartSubtotalAmountOffAction")).Name; CommerceCommand command = Proxy.DoCommand(container.DoAction(view)); -
給付価値プロパティを設定します。例えば、以下のサンプルではAmountOff値を50に設定しています。
view = command.Models.OfType
().FirstOrDefault(v => v.Name.Equals(view.Name)); var amountProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("AmountOff")); amountProperty.Value = "50"; command = Proxy.DoCommand(container.DoAction(view));"CartSubtotalAmountOffAction -
行動を実行する:
command = Proxy.DoCommand(container.DoAction(view));
給付IDはBenefitAdded モデルを用いて返されます。例えば:
var benefitId = addAction.Models.OfType
().FirstOrDefault()?.BenefitId;
編集a benefit(C#)
既存の給付金の資産価値を変更することで変更することができます。
例えば、Get Cart Subtotal [特定]Amount Off特典の割引金額の価値を変更するために、給付を編集するには:
-
エンティティビューを入手:
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, "BenefitDetails", "EditBenefit", benefitId));
-
例えば、"AmountOff" プロパティの値を20に修正します。
var amountProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("AmountOff")); amountProperty.Value = "20";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
Delete a Benefit (C#)
昇進の特典は削除できます。
特典を削除するには:
-
エンティティビューを取得し、クエリにプロモーションのフレンドリーIDと削除したいベネフィットIDを含めてください。例えば:
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, string.Empty, "DeleteBenefit", benefitId));
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
プロモーションにアイテムを追加(C#)
目的声明を確認する必要がありますが、ステップ2のコードサンプルと合致するかはわかりません。商品(例えば、販売可能な商品やそのバリエーション)をプロモーションに追加し、プロモーションはカタログレベルでではなく個別の商品に適用されます。
!注昇進は、Draft州にある場合にのみ変更できます。 承認 された州にある昇進は変更できません。
プロモーションに商品を追加するには:
-
エンティティビューを入手:
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, "ItemDetails", "AddItem", string.Empty));
-
ビューのプロパティを修正し、例えば 除外されていない プロパティをプロモーションに追加する:
var catalogProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Catalog")); var availableCatalogsPolicy = catalogProperty.Policies.OfType
().FirstOrDefault(); catalogProperty.Value = availableCatalogsPolicy?.List.FirstOrDefault(o => o.Name.Equals("MyCatalog"))?.Name; var itemIDProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("ItemId")); itemIDProperty.Value = "MyProduct|MyCatalog|MyVariant"; var excludedProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Excluded")); excludedProperty.Value = "false"; -
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
アイテムIDはPromotionItemAdded モデルを用いて返されます。例えば:
string itemId = command.Models.OfType
().FirstOrDefault()?.PromotionItemId;
プロモーションからアイテムを削除する(C#)
Views and Actions APIを使って、プロモーションからアイテムを削除することができます。
プロモーションから商品を削除するには:
-
エンティティビューを取得し、クエリにプロモーションのフレンドリーIDと削除したいアイテムID(例えば):
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, string.Empty, "RemoveItem", itemId));
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
プロモーションに公開クーポンを追加(C#)
パブリッククーポンとは、複数回使用できるテキストの列です。
プロモーションに公開クーポンを追加するには:
-
エンティティビューを入手:
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, "PublicCoupons", "AddPublicCoupon", string.Empty));
-
ビューのプロパティを修正して、例えばcodeProperty.Valueを指定します:
var codeProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Code")); codeProperty.Value = "MyPublicCoupon_ABC123";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
プロモーションにプライベートクーポンを追加(C#)
プライベートクーポンは、単一の顧客に割り当てられる割引コードのことです。作成したいプライベートクーポンの数を指定できます
プロモーションにプライベートクーポンを追加するには:
-
例えば、エンティティビューを取得してください:
string promotionId = $"Entity-Promotion-{promotionFriendlyId}"; EntityView view = Proxy.GetValue(container.GetEntityView(promotionId, "CouponDetails", "AddPrivateCoupon", string.Empty));
-
ビューのプロパティを変更してクーポン割り当ての詳細を指定します。以下は20種類の割り当てを作成するクエリです。
var prefixProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Prefix")); prefixProperty.Value = "before_"; var suffixProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Suffix")); suffixProperty.Value = "_after"; var totalProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Total")); totalProperty.Value = "20";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
例えば、クーポンフレンドリーIDはPrivateCouponGroupAddedモデルを使って返されます
string privateCouponId = command.Models.OfType
().FirstOrDefault()?.GroupFriendlyId;
プライベートクーポン(C#)を割り当てる
Promotions Views and Actions APIを使って、生成されたプライベートクーポンを特定のプロモーションキャンペーンに割り当てることができます。
プライベートクーポンの割り当て方法:
-
アクションのエンティティビューを取得できます:
string groupId = $"Entity-PrivateCouponGroup--{privateCouponId}"; EntityView view = Proxy.GetValue(container.GetEntityView(groupId, "AllocationDetails", "NewAllocation", string.Empty));
-
例えば、ビューのプロパティを10クーポン割り当てするなどを修正します。
var countProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Count")); countProperty.Value = "10";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
割り当てられたクーポンコードのリストはPrivateCouponListモデルで返されます。
昇進の重複(C#)
既存のプロモーションを「ビューズ&アクション」APIを使って複製し、同じプロモーションブック内で新しいプロモーションを作成できます。新しいプロモーションはDraftステータスにあり、編集が可能です。
昇進を重複するには:
-
アクションのエンティティビューを取得できます:
DataServiceQuerySingle
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "Details", "DuplicatePromotion", string.Empty); EntityView view = Proxy.GetValue(query); -
ビューのプロパティを修正します。例えば:
var nameProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("PromotionDuplicateName")); nameProperty.Value = "MyDuplicatePromotion";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
昇進ステータスの変更
昇進は 昇進承認プロセスの対象となります。承認プロセス中に昇進ステータスは以下のように移行することがあります:
- Draft年からReadyForApprovalまで(C#年承認のために昇進を申し込むことを参照)
- ReadyForApprovalからDraftまで(昇進拒否(C#)参照)
- ReadyForApproval年からApprovedまで(昇進承認(C#)を参照)
- ApprovedからDisabledまで(承認されたプロモーションを無効にする項目を参照)
昇進を承認のために提出する(C#)
承認のために昇進案を提出できます。
昇進の承認を申請するには:
-
アクションの現場を把握しましょう:
// requesting approval DataServiceQuerySingle
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "SetPromotionApprovalStatus", "RequestPromotionApproval", snapshotId); EntityView view = Proxy.GetValue(query); -
ビューのプロパティを修正して承認を要求する:
var commentProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Comment")); commentProperty.Value = "Requesting approval";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
プロモーションのステータスはDraftからReadyForApprovalへと変わります。
昇進を拒否する(C#)
昇進のステータスがReadyForApprovalであれば却下できます。
昇進を拒否してドラフトステータスに戻す方法:
-
アクションの現場を把握しましょう:
// rejecting DataServiceQuerySingle
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "SetPromotionApprovalStatus", "RejectPromotion", snapshotId); EntityView view = Proxy.GetValue(query); -
ビューのプロパティを修正して承認リクエストを拒否します:
var commentProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Comment")); commentProperty.Value = "Rejecting approval";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
プロモーションはDraftステータスに戻ります。
昇進を承認する(C#)
昇進のステータスがReadyForApproval時には承認できます。
昇進を承認するには:
-
アクションの現場を把握しましょう:
// approving DataServiceQuerySingle
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "SetPromotionApprovalStatus", "ApprovePromotion", snapshotId); EntityView view = Proxy.GetValue(query); -
ビューのプロパティを修正してプロモーションを承認する:
var commentProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Comment")); commentProperty.Value = "Approving";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
プロモーションのステータスはApprovedに変わります。
承認されたプロモーションを無効にする
承認されたプロモーションを無効にすることができます。プロモーションを無効にすると、承認されたままですが、もはや有効ではありません。無効化されたプロモーションを再有効化することはできません。
承認されたプロモーションを無効にすること
-
アクションの現場を把握しましょう:
DataServiceQuerySingle
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", "SetPromotionApprovalStatus", "RetractPromotion", snapshotId); EntityView view = Proxy.GetValue(query); -
ビューのプロパティを変更してアクティブなプロモーションを無効にする:
var commentProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Comment")); commentProperty.Value = "Retracting the promotion";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
昇進(C#)を削除する
昇進がDraftステータスの場合は削除できます。
プロモーションを削除するには:
-
例えば、アクションのエンティティビューを取得してください:
DataServiceQuerySingle
query = container.GetEntityView($"Entity-Promotion-{promotionFriendlyId}", string.Empty, "DeletePromotion", string.Empty); EntityView view = Proxy.GetValue(query); -
ビューのプロパティを修正して、例えばpromotionFriendlyIdを指定します:
view.ItemId = $"Entity-Promotion-{promotionFriendlyId}";
-
行動を実行する:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));