Show minimum to maximum price range on product page - AC Gold

From AbleCommerce Wiki
Jump to: navigation, search

Show minimum to maximum price range on product page

For example you have a product let's say T-Shirt with three different sizes Small, Medium, Large. Every size has a different price. Now on product display page you want the customer to see a price range showing minimum available price to maximum available price.

This customization considers that you are using one option with product. This customization will not handle tax inclusive price display, no variants considerations and no kitting handling.

  • Edit your Website/Conlib/Utility/ProductPrice.ascx.cs file and locate following line of code
else
{
    Price.Text = string.Format(_PriceFormat, priceWithVAT.LSCurrencyFormat("ulc"));
}

and update it as below

else
{
   decimal maxPrice = 0;
     foreach (ProductOption po in _Product.ProductOptions)
     {
        foreach (OptionChoice oc in po.Option.Choices)
        {
          if (oc.PriceModifier > maxPrice)
             maxPrice = oc.PriceModifier ?? 0;
        }
     }

      if (_Product.ProductOptions.Count > 0)
       Price.Text = string.Format(_PriceFormat, _Product.Price) + string.Format(" - {0}", _Product.Price + maxPrice);
      else
       Price.Text = string.Format(_PriceFormat, priceWithVAT.LSCurrencyFormat("ulc"));
}
  • Now create a Product with one option and then when adding its option choices specify price modifiers for each choice. Finally open the product page from retail side to see the changes.