Remove Price form ERp request for pages


Search Page 

When user clicks search > ProductController > SearchAsync/search 

ExtendedCatalogApi

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 = shop.UserAbilities.Has(AbilityTo.ViewPrices);
           else
               options.CalculatePrices = false;
 
           return options;
       }




Last Viewd Page
under the product detail page. and product detail main page.(when click select all )

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 = shop.UserAbilities.Has(AbilityTo.ViewPrices);
            else
                options.CalculatePrices = false;

            return options;
        }


Wish List
_Edit under Wishlist.

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 = true;
            else
                options.CalculatePrices = false;
            return options;
 
        }
    }

public class ExtendedOrderManager : OrderManager<IExtendedOrderProvider>
    {
        public override IBasket CalculateWishlist(IBasket wishlist, CalculationSettings settings)
        {
            Guard.ThrowIfNull(wishlist, "wishlist");
            Guard.ThrowIfNull(settings, "settings");

            var copy = (IBasket)ServiceManager.GetInstance<ICloner>().Clone(wishlist);
            // [59252] 3.4. SHOW PRICES BASED ON THE SUPPLIER AND NO-PRICE SITUATION IN WEBSHOP
            return ServiceManager.GetInstance<ExtendedWishlistCalculator>().Calculate(copy, settings);
        }
    }



Checkout Offer

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;
                options.CalculatePrices = true;

                // [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>();
        }