/// <summary> /// Gets the product bulk prices. /// </summary> /// <param name="storefront">The storefront.</param> /// <param name="visitorContext">The visitor context.</param> /// <param name="catalogName">Name of the catalog.</param> /// <param name="productIds">The product ids.</param> /// <param name="priceTypeIds">The price type ids.</param> /// <returns> /// The manager response with the list of prices in the Result. /// </returns> public virtual ManagerResponse <Sitecore.Commerce.Services.Prices.GetProductBulkPricesResult, IDictionary <string, Price> > GetProductBulkPrices([NotNull] CommerceStorefront storefront, [NotNull] IVisitorContext visitorContext, string catalogName, IEnumerable <string> productIds, params string[] priceTypeIds) { Assert.ArgumentNotNull(storefront, "storefront"); if (priceTypeIds == null) { priceTypeIds = DefaultPriceTypeIds; } var request = new Requests.GetProductBulkPricesRequest(catalogName, productIds, priceTypeIds); request.CurrencyCode = StorefrontManager.GetCustomerCurrency(); var result = this._pricingServiceProvider.GetProductBulkPrices(request); // Currently, both Categories and Products are passed in and are waiting for a fix to filter the categories out. Until then, this code is commented // out as it generates an unecessary Error event indicating the product cannot be found. // Helpers.LogSystemMessages(result.SystemMessages, result); return(new ManagerResponse <Sitecore.Commerce.Services.Prices.GetProductBulkPricesResult, IDictionary <string, Price> >(result, result.Prices == null ? new Dictionary <string, Price>() : result.Prices)); }
/// <summary> /// Gets the product prices. /// </summary> /// <param name="storefront">The storefront.</param> /// <param name="visitorContext">The visitor context.</param> /// <param name="catalogName">Name of the catalog.</param> /// <param name="productId">The product identifier.</param> /// <param name="includeVariants">if set to <c>true</c> [include variants].</param> /// <param name="priceTypeIds">The price type ids.</param> /// <returns> /// The manager response with the list of prices in the Result. /// </returns> public virtual ManagerResponse <Sitecore.Commerce.Services.Prices.GetProductPricesResult, IDictionary <string, Price> > GetProductPrices([NotNull] CommerceStorefront storefront, [NotNull] IVisitorContext visitorContext, string catalogName, string productId, bool includeVariants, params string[] priceTypeIds) { Assert.ArgumentNotNull(storefront, "storefront"); if (priceTypeIds == null) { priceTypeIds = DefaultPriceTypeIds; } var request = new Requests.GetProductPricesRequest(catalogName, productId, priceTypeIds); if (Sitecore.Context.User.IsAuthenticated) { request.UserId = visitorContext.GetCustomerId(); } request.IncludeVariantPrices = includeVariants; request.CurrencyCode = StorefrontManager.GetCustomerCurrency(); var result = this._pricingServiceProvider.GetProductPrices(request); // Helpers.LogSystemMessages(result.SystemMessages, result); return(new ManagerResponse <Sitecore.Commerce.Services.Prices.GetProductPricesResult, IDictionary <string, Price> >(result, result.Prices == null ? new Dictionary <string, Price>() : result.Prices)); }