Related issue : Borsig : [59252] 3.4. SHOW PRICES BASED ON THE SUPPLIER AND NO-PRICE SITUATION IN WEBSHOP
set CalculatePrices ,CalculateInventory True/false
Product List Page (Search Page) Last View Page (under Product detail page)
public class ExtendedCatalogApi : CatalogApi { protected override IProductLoadOptions CreateProductListLoadOptions(bool loadRelatedSkus, bool loadImages) { var options = base.CreateProductListLoadOptions(loadRelatedSkus, loadImages); // [59252] 3.4. SHOW PRICES BASED ON THE SUPPLIER AND NO-PRICE SITUATION IN WEBSHOP var shop = ShopContext.GetCurrent(); if (!((ExtendedWebsiteSettings)shop.Settings).ShowPricesInProductListPage) options.CalculatePrices = false; return options; } protected override IProductLoadOptions CreateLastViewedProductsLoadOptions() { var options = base.CreateLastViewedProductsLoadOptions(); // [59252] 3.4. SHOW PRICES BASED ON THE SUPPLIER AND NO-PRICE SITUATION IN WEBSHOP var shop = ShopContext.GetCurrent(); if (!((ExtendedWebsiteSettings)shop.Settings).ShowPricesInProductListPage) options.CalculatePrices = false; return options; } }
Wish List
public class ExtendedWishlistCalculator : WishlistCalculator { protected override IProductLoadOptions CreateLoadOptions() { var options = base.CreateLoadOptions(); // [59252] 3.4. SHOW PRICES BASED ON THE SUPPLIER AND NO-PRICE SITUATION IN WEBSHOP var shop = ShopContext.GetCurrent(); if (!((ExtendedWebsiteSettings)shop.Settings).ShowPricesInProductListPage) options.CalculatePrices = false; return options; } }
checkout offers > under Basket
public override IProductCollection GetCheckoutOffers() { var shopContext = ShopContext.GetCurrent(); var ids = shopContext.Settings.CheckoutOfferingsIdList.iDistinct().ToList(); if (ids.Count > 0) { var options = ObjectFactory.Create<IProductLoadOptions>(); options.VisibleOnly = true; options.LoadImages = true; options.CalculateInventory = false; // [59252] 3.4. SHOW PRICES BASED ON THE SUPPLIER AND NO-PRICE SITUATION IN WEBSHOP if (((ExtendedWebsiteSettings)shopContext.Settings).ShowPricesInProductListPage) options.CalculatePrices = true; else options.CalculatePrices = false; return CommerceFrameworkBase.Products.GetProductsByIdList(ids, options); } return ObjectFactory.Create<IProductCollection>(); }
Ravensburg
Get stock by product ids
ExtendedProductManager
//Ticket 113689: [Ravensburger - Phase 2] 3.1. Display stock availability in the shopping cart /// <summary> /// This method will update Product invenrty value by calling Get stock. /// </summary> /// <param name="products"></param> public void UpdateInvenrtyValueByProductList(IList<IProduct> products) { var productIds = products.Select(x => x.Id).ToList(); var productsLoadOptions = ObjectFactory.Create<IProductLoadOptions>(); productsLoadOptions.CalculateInventory = true; var ProductsWithInventry = ShopApi.Catalog.GetProductsByIdList(productIds, productsLoadOptions); //map the Inventy value with Basket's object. foreach (var item in ProductsWithInventry) { var prod = products.Where(x => x.Id == item.Id).FirstOrDefault(); prod.Inventory = item.Inventory; } }