Sellableアイテムのコマンド、パイプライン、ブロック

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

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

次の表では、Sellableアイテムのコマンドとパイプラインについて説明します。

コマンド/パイプライン

形容

CreateSellableItemCommand

CreateSellableItemPipeline

Commerce Engineで新しいSellable商品を作成します。

パラメーター:

  • productId: Sellable商品の一意の識別子

  • name: Sellable商品の内部名

  • displayName: Sellable商品の表示名

  • description: Sellable商品の説明

  • brand: 販売可能な商品のブランド

  • manufacturer: 販売可能な商品のメーカー

  • typeOfGood: 販売可能な商品のタイプ

  • tags: Sellable商品に関連付けられたタグ

メモ

Sellable商品をプログラムで作成する場合は、この に示すように、新しい商品をカタログに明示的に関連付ける必要もあります。

CreateSellableItemVariationCommand

CreateSellableItemVariationPipeline

既存のSellable商品のバリエーションを作成します。

パラメーター:

  • sellableItemId: 親Sellable商品の識別子

  • variantId: Sellable商品バリアントの識別子

  • variantName: Sellable商品バリアントの名前

  • variantDisplayName: Sellable商品バリアントの表示名

DeleteSellableItemCommand 

指定したSellable商品を削除します。

パラメーター:

  • sellableItemId: Sellable商品の一意の識別子。

DeleteSellableItemVariationCommand 

Sellable商品の指定したvariant を削除します。

パラメーター:

  • sellableItemId: 親Sellable商品の一意の識別子。

  • variantId: Sellable商品バリアントの一意の識別子。

DisableSellableItemVariationCommand

DisableSellableItemVariationPipeline

指定したバリアントをSellable商品から削除します。

パラメーター:

  • sellableItemId: 親Sellable商品の識別子

  • variantId: Sellable商品バリアントのID

EditSellableItemCommand

EditSellableItemPipeline

既存のSellable商品に変更を加えます。

  • sellableItem: Sellable商品の識別子

GetBulkPricesCommand

GetSellableItemPipeline

Sellable商品識別子の文字列を取得し、各商品の一括価格設定モデルを返します。バリアントIDが指定されている場合は特定のバリアントの価格を返し、それ以外の場合はすべてのバリアントの価格を返します。

パラメーター:

  • itemIds: アイテム識別子の区切りリスト。には、特定のアイテム (文字列) を完全に記述するためのCatalog、ProductId、およびVariantIdが含まれています。

GetSellableItemsByParentCommand

GetSellableItemsByParentPipeline

指定した親 (つまり、カタログまたはカテゴリ) に属するすべてのSellable商品を取得します。

パラメーター:

  • ParentId: カタログまたはカテゴリの識別子

  • Skip: スキップする項目の数

  • Take: スキップする項目の数

GetSellableItemCommand

GetSellableItemPipeline

指定したSellable商品を取得します。

パラメーター:

  • itemId: Sellable商品の識別子

  • filterVariations: Sellable商品のバリエーションを取得する必要があるかどうかを示します

GetSellableItemsCommand

GetSellableItemsPipeline

システム内のすべてのSellable商品のリストを取得します。

パラメータ: なし。

RemoveListPricesCommand

RemoveListPricesPipeline

Sellable商品の指定された定価を削除します。

パラメーター:

  • itemId: Sellable商品の識別子

  • prices: Sellableアイテムのさまざまな通貨の価格の区切り文字列

UpdateListPricesCommand

UpdateListPricesPipeline

Sellable商品の指定された定価 (異なる通貨) を追加または更新します。

パラメーター:

  • itemId: Sellable商品の識別子

  • prices: Sellableアイテムのさまざまな通貨の価格の区切り文字列

UpdateSellableItemPurchasableCommand

アイテムが購入可能かどうかを判断します。

  • true:アイテムは購入可能です

  • false:アイテムは購入できません。

DeleteSellableItemBundleReferencesBlock

削除される商品がSellable商品であるかどうかを確認し、必要に応じてバンドルの関連付けをクリーンアップします。

例: Sellable商品をプログラムで作成する

CreateSellableItemコマンドを使用して、Sellable商品をプログラムで作成します。コードを使用してSellable商品を作成する場合、関連するカタログへの明示的な関連付けも含める必要があります。

次の例は、必要なカタログの関連付けを含むサンプルのcreateSellableItemコマンドを示しています。

namespace Sitecore.Commerce.Plugin.Sample
{
    using System;
    using System.Threading.Tasks;
    using Sitecore.Commerce.Core;
    using Sitecore.Commerce.Core.Commands;
    using Sitecore.Commerce.Plugin.Catalog;

    /// <inheritdoc />
    /// <summary>
    /// Defines the SampleCommand command.
    /// </summary>
    public class SampleCommand : CommerceCommand
    {
        private readonly CreateSellableItemCommand _createSellableItemCommand;

        private readonly AssociateSellableItemToParentCommand _associateSellableItemToParent;

        public SampleCommand(CreateSellableItemCommand createSellableItemCommand, AssociateSellableItemToParentCommand associateSellableItemToParent, IServiceProvider serviceProvider) : base(serviceProvider)
        {
            _createSellableItemCommand = createSellableItemCommand;
            _associateSellableItemToParent = associateSellableItemToParent;
        }

        public async Task<SampleEntity> Process(CommerceContext commerceContext, string catalogID)
        {
            using (var activity = CommandActivity.Start(commerceContext, this))
            {
                SellableItem sellableItem = await _createSellableItemCommand.Process(commerceContext, "My Prodcut ID", "", "My Product Name", "My Product DisplayName", "My Description", "My Brand", "Manufacturer", Array.Empty<string>()).ConfigureAwait(continueOnCapturedContext: false);
                if (sellableItem != null)
                {
                    await _associateSellableItemToParent.Process(commerceContext, "Entity-Catalog-Habitat_Master", catalogID, sellableItem.Id).ConfigureAwait(continueOnCapturedContext: false);
                }

                return new SampleEntity();
            }
        }
    }
}
この記事を改善するための提案がある場合は、 お知らせください!