August 27, 2010

Hide Product Price if Price Is Zero in Product Description in Nopcommerce


If Product Price is set as zero in Nopcommerce 1.4 You ll see the zero price in Description.
If you want to hide that zero price make the below highlighted changes


1.) In File ProductPrice.ascx  

      Add the outer most panel with id= "pnlHidePrice"

<asp:Panel ID="pnlHidePrice" runat ="server">
<asp:PlaceHolder runat="server" ID="phOldPrice">

    <%=GetLocaleResourceString("Products.OldPrice")%>&nbsp;
    <asp:Label ID="lblOldPrice" runat="server" CssClass="oldProductPrice" />
</asp:PlaceHolder>
<br />
<asp:Label ID="lblPrice" runat="server" Visible="false" />
<asp:Label ID="lblPriceValue" runat="server" CssClass="productPrice" />
<asp:PlaceHolder runat="server" ID="phDiscount">
    <br />
    <%=GetLocaleResourceString("Products.FinalPriceWithDiscount")%>&nbsp;&nbsp;
    <asp:Label ID="lblFinalPriceWithDiscount" runat="server" CssClass="productPrice" />
</asp:PlaceHolder>
</asp:Panel>


2.)In File ProductPrice.ascx.cs 
if (phDiscount.Visible || phOldPrice.Visible)
                {
                   
                    lblPrice.Text = GetLocaleResourceString("Products.FinalPriceWithoutDiscount");
                   
                   
                }

                ////Code Added to Hide the price                       if (finalPriceWithoutDiscount == 0)
                {
                    pnlHidePrice.Visible = false;
                }

No comments:

Post a Comment