Difference between revisions of "Show minimum to maximum price range on product page - AC Gold"

From AbleCommerce Wiki
Jump to: navigation, search
(New page: '''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 pric...)
 
 
Line 16: Line 16:
 
<pre>
 
<pre>
 
else
 
else
                    {
+
{
                        decimal maxPrice = 0;
+
  decimal maxPrice = 0;
                                foreach (ProductOption po in _Product.ProductOptions)
+
    foreach (ProductOption po in _Product.ProductOptions)
                                {
+
    {
                                    foreach (OptionChoice oc in po.Option.Choices)
+
        foreach (OptionChoice oc in po.Option.Choices)
                                    {
+
        {
                                        if (oc.PriceModifier > maxPrice)
+
          if (oc.PriceModifier > maxPrice)
                                            maxPrice = oc.PriceModifier ?? 0;
+
            maxPrice = oc.PriceModifier ?? 0;
                                    }
+
        }
                                }
+
    }
  
                                if (_Product.ProductOptions.Count > 0)
+
      if (_Product.ProductOptions.Count > 0)
                                    Price.Text = string.Format(_PriceFormat, _Product.Price) + string.Format(" - {0}", _Product.Price + maxPrice);
+
      Price.Text = string.Format(_PriceFormat, _Product.Price) + string.Format(" - {0}", _Product.Price + maxPrice);
                                else
+
      else
                                    Price.Text = string.Format(_PriceFormat, priceWithVAT.LSCurrencyFormat("ulc"));
+
      Price.Text = string.Format(_PriceFormat, priceWithVAT.LSCurrencyFormat("ulc"));
                    }
+
}
 
</pre>
 
</pre>
  
 
* 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.
 
* 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.

Latest revision as of 16:09, 3 December 2012

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.