Hello
How do i get the price added on products on the front page?
On the six products there?
ref: cene.dk
<span class="price">
<asp:PlaceHolder runat="server" ID="phOldPrice">
<%=GetLocaleResourceString("Products.OldPrice")%>
<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")%>
<asp:Label ID="lblFinalPriceWithDiscount" runat="server" CssClass="productPrice" />
</asp:PlaceHolder>
</span>
var phOldPrice = e.Item.FindControl("phOldPrice") as PlaceHolder;
var lblOldPrice = e.Item.FindControl("lblOldPrice") as Label;
var lblPrice = e.Item.FindControl("lblPrice") as Label;
var lblPriceValue = e.Item.FindControl("lblPriceValue") as Label;
var phDiscount = e.Item.FindControl("phDiscount") as PlaceHolder;
var lblFinalPriceWithDiscount = e.Item.FindControl("lblFinalPriceWithDiscount") as Label;
if (phOldPrice != null && lblOldPrice != null && lblPrice != null && lblPriceValue != null && phDiscount != null && lblFinalPriceWithDiscount != null)
{
var productVariant = product.MinimalPriceProductVariant;
if (productVariant != null)
{
if (!this.SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
(NopContext.Current.User != null &&
!NopContext.Current.User.IsGuest))
{
if (productVariant.CustomerEntersPrice)
{
phOldPrice.Visible = false;
lblPrice.Visible = false;
lblPriceValue.Visible = false;
phDiscount.Visible = false;
}
else
{
if (productVariant.CallForPrice)
{
lblPriceValue.Text = GetLocaleResourceString("Products.CallForPrice");
phOldPrice.Visible = false;
phDiscount.Visible = false;
}
else
{
decimal taxRate = decimal.Zero;
decimal oldPriceBase = this.TaxService.GetPrice(productVariant, productVariant.OldPrice, out taxRate);
decimal finalPriceWithoutDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false), out taxRate);
decimal finalPriceWithDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, true), out taxRate);
decimal oldPrice = this.CurrencyService.ConvertCurrency(oldPriceBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
decimal finalPriceWithoutDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithoutDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
decimal finalPriceWithDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
if (finalPriceWithoutDiscountBase != oldPriceBase && oldPriceBase > decimal.Zero)
{
lblOldPrice.Text = PriceHelper.FormatPrice(oldPrice);
lblPriceValue.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
phOldPrice.Visible = true;
}
else
{
lblPriceValue.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
phOldPrice.Visible = false;
}
if (finalPriceWithoutDiscountBase != finalPriceWithDiscountBase)
{
lblFinalPriceWithDiscount.Text = PriceHelper.FormatPrice(finalPriceWithDiscount);
phDiscount.Visible = true;
}
else
{
phDiscount.Visible = false;
}
if (phDiscount.Visible)
{
lblPriceValue.CssClass = string.Empty;
}
else
{
lblPriceValue.CssClass = "productPrice";
}
if (phDiscount.Visible || phOldPrice.Visible)
{
lblPrice.Text = GetLocaleResourceString("Products.FinalPriceWithoutDiscount");
}
}
}
}
else
{
phOldPrice.Visible = false;
lblOldPrice.Visible = false;
lblPrice.Visible = false;
lblPriceValue.Visible = false;
phDiscount.Visible = false;
lblFinalPriceWithDiscount.Visible = false;
}
}
}
<asp:Panel ID="pnlStockAvailablity" runat="server" class="stock">
<asp:Label ID="lblStockAvailablity" runat="server" />
</asp:Panel>
var pnlStockAvailablity = e.Item.FindControl("pnlStockAvailablity") as Panel;
var lblStockAvailablity = e.Item.FindControl("lblStockAvailablity") as Label;
if (pnlStockAvailablity != null && lblStockAvailablity != null)
{
var productVariant = product.MinimalPriceProductVariant;
string stockMessage = productVariant.FormatStockMessage();
if (!String.IsNullOrEmpty(stockMessage))
{
lblStockAvailablity.Text = stockMessage;
}
else
{
pnlStockAvailablity.Visible = false;
}
}
<asp:Label ID="lblShortDescription" runat="server"></asp:Label>
var lblShortDescription = e.Item.FindControl("lblShortDescription") as Label;
if (lblShortDescription != null)
{
lblShortDescription.Text = product.ShortDescription;
}
<span class="price">
<asp:PlaceHolder runat="server" ID="phOldPrice">
<%=GetLocaleResourceString("Products.OldPrice")%>
<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")%>
<asp:Label ID="lblFinalPriceWithDiscount" runat="server" CssClass="productPrice" />
</asp:PlaceHolder>
</span>
var phOldPrice = e.Item.FindControl("phOldPrice") as PlaceHolder;
var lblOldPrice = e.Item.FindControl("lblOldPrice") as Label;
var lblPrice = e.Item.FindControl("lblPrice") as Label;
var lblPriceValue = e.Item.FindControl("lblPriceValue") as Label;
var phDiscount = e.Item.FindControl("phDiscount") as PlaceHolder;
var lblFinalPriceWithDiscount = e.Item.FindControl("lblFinalPriceWithDiscount") as Label;
if (phOldPrice != null && lblOldPrice != null && lblPrice != null && lblPriceValue != null && phDiscount != null && lblFinalPriceWithDiscount != null)
{
var productVariant = product.MinimalPriceProductVariant;
if (productVariant != null)
{
if (!this.SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
(NopContext.Current.User != null &&
!NopContext.Current.User.IsGuest))
{
if (productVariant.CustomerEntersPrice)
{
phOldPrice.Visible = false;
lblPrice.Visible = false;
lblPriceValue.Visible = false;
phDiscount.Visible = false;
}
else
{
if (productVariant.CallForPrice)
{
lblPriceValue.Text = GetLocaleResourceString("Products.CallForPrice");
phOldPrice.Visible = false;
phDiscount.Visible = false;
}
else
{
decimal taxRate = decimal.Zero;
decimal oldPriceBase = this.TaxService.GetPrice(productVariant, productVariant.OldPrice, out taxRate);
decimal finalPriceWithoutDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false), out taxRate);
decimal finalPriceWithDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, true), out taxRate);
decimal oldPrice = this.CurrencyService.ConvertCurrency(oldPriceBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
decimal finalPriceWithoutDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithoutDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
decimal finalPriceWithDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
if (finalPriceWithoutDiscountBase != oldPriceBase && oldPriceBase > decimal.Zero)
{
lblOldPrice.Text = PriceHelper.FormatPrice(oldPrice);
lblPriceValue.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
phOldPrice.Visible = true;
}
else
{
lblPriceValue.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
phOldPrice.Visible = false;
}
if (finalPriceWithoutDiscountBase != finalPriceWithDiscountBase)
{
lblFinalPriceWithDiscount.Text = PriceHelper.FormatPrice(finalPriceWithDiscount);
phDiscount.Visible = true;
}
else
{
phDiscount.Visible = false;
}
if (phDiscount.Visible)
{
lblPriceValue.CssClass = string.Empty;
}
else
{
lblPriceValue.CssClass = "productPrice";
}
if (phDiscount.Visible || phOldPrice.Visible)
{
lblPrice.Text = GetLocaleResourceString("Products.FinalPriceWithoutDiscount");
}
}
}
}
else
{
phOldPrice.Visible = false;
lblOldPrice.Visible = false;
lblPrice.Visible = false;
lblPriceValue.Visible = false;
phDiscount.Visible = false;
lblFinalPriceWithDiscount.Visible = false;
}
}
}