I am using Minion and i wanted to get the Sitecore item from Minion? I can't add in the policy file. I am using Sitecore 9.0.1 version
Any pipeline or command to use here?
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityI am using Minion and i wanted to get the Sitecore item from Minion? I can't add in the policy file. I am using Sitecore 9.0.1 version
Any pipeline or command to use here?
You can use:
Sitecore.Commerce.Plugin.Management.IGetItemByIdPipeline
string defaultLanguage = context.GetPolicy<GlobalEnvironmentPolicy>().DefaultLocale;
ItemModelArgument itemModelArgument = new ItemModelArgument("{itemPath}");
itemModelArgument.Language = defaultLanguage;
IEnumerable<ItemModel> itemModels = await _getItemsByPathPipeline.Run(itemModelArgument, context);
Sitecore.Commerce.Plugin.Management.IGetItemsByPathPipeline
string defaultLanguage = context.GetPolicy<GlobalEnvironmentPolicy>().DefaultLocale;
ItemModelArgument itemModelArgument = new ItemModelArgument("{ItemID}");
itemModelArgument.Language = defaultLanguage;
ItemModel itemModel = await _getItemByIdPipeline.Run(itemModelArgument, context);
I am using commerce 9 update 3. When i am using IGetItemByIdPipeline, it is returning only default 14 properties but when i use IGetItemByPathPipeline , i get the sitecore item field values also.
I need to get the sitecore fields, So i was able to get the sitecore item in CalculateCartFulfillmentBlock pipeline by adding code shown below.
Make sure to have CommerceCommander __commander context injected into the pipeline block constructor.
ItemModelArgument itemModelArgument = new
ItemModelArgument("/sitecore/Content/Data/DynamicShippingOptions");
itemModelArgument.Language = defaultLanguage;
ItemModel itemModel = await _commander.Pipeline<IGetItemByPathPipeline>().Run(itemModelArgument, context);