Skip to content

Instantly share code, notes, and snippets.

@brijbaroda
Created November 17, 2019 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brijbaroda/2967617aa9601a7dc06e11129d5d2c07 to your computer and use it in GitHub Desktop.
Save brijbaroda/2967617aa9601a7dc06e11129d5d2c07 to your computer and use it in GitHub Desktop.
Sitecore Commerce - Localizing Category - Command
using POC.Localization.Pipelines;
using POC.Localization.Pipelines.Arguments;
using Sitecore.Commerce.Core;
using Sitecore.Commerce.Core.Commands;
using Sitecore.Commerce.Plugin.Catalog;
using System;
using System.Threading.Tasks;
namespace POC.Localization.Commands
{
class LocalizeCatalogItemsCommand : CommerceCommand
{
private readonly ILocalizeCatalogItemsPipeline _pipeline;
public LocalizeCatalogItemsCommand(ILocalizeCatalogItemsPipeline pipeline,IServiceProvider serviceProvider) : base(serviceProvider)
{
this._pipeline = pipeline;
}
/// <summary>
/// The process of the command
/// </summary>
/// <param name="commerceContext">
/// The commerce context
/// </param>
/// <param name="parameter">
/// The parameter for the command
/// </param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
public async Task<string> Process(CommerceContext commerceContext)
{
using (var activity = CommandActivity.Start(commerceContext, this))
{
string retVal = string.Empty;
var context = commerceContext.PipelineContextOptions;
LocalizationPipelineArgument pArg = new LocalizationPipelineArgument();
retVal = await this._pipeline.Run(pArg, context);
return retVal;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment