Hi, Need help with customization of HomePageProducts.cshtml on nopcommerce v.2.0 I tried use @item.ProductPrice.Price, but it`s not display. How to get price and display on template?
Thanks Andrei, it`s work fine. Is there any way display products on homepage like on category grid or simple add add to cart button?
Thank you for help, nopCommerce best e-commerce solution
P.S Many websites use price and add to cart buttons on homepage products template http://www.templatemonster.com/category.php?tid=-+Any+-&search_words=store&from_=-+Any+-&to=-+Any+-&type=&cat=&style=&author=
I am using NC version 2.65. I need to display price in small box on homepage. I was able to display detail and add to cart button but price is not shown. Even I have place the code as follows:
In order to see the price on home page, I feel like there may be something need to be done in the following code where it says hid price. Can anybody help me how to show the product price in small box on home page.
if (_permissionService.Authorize(StandardPermissionProvider.DisplayPrices)) { //calculate for the maximum quantity (in case if we have tier prices) decimal? minimalPrice = null; var productVariant = _priceCalculationService.GetProductVariantWithMinimalPrice(productVariants, _workContext.CurrentCustomer, true, int.MaxValue, out minimalPrice);
if (!productVariant.CustomerEntersPrice) { if (productVariant.CallForPrice) { priceModel.OldPrice = null; priceModel.Price = _localizationService.GetResource("Products.CallForPrice"); } else if (minimalPrice.HasValue) { //calculate prices decimal taxRate = decimal.Zero; decimal oldPriceBase = _taxService.GetProductPrice(productVariant, productVariant.OldPrice, out taxRate); decimal finalPriceBase = _taxService.GetProductPrice(productVariant, minimalPrice.Value, out taxRate);
//do we have tier prices configured? var tierPrices = new List<TierPrice>(); if (productVariant.HasTierPrices) { tierPrices.AddRange(productVariant.TierPrices .OrderBy(tp => tp.Quantity) .ToList() .FilterForCustomer(_workContext.CurrentCustomer) .RemoveDuplicatedQuantities()); } bool displayFromMessage = //When there is just one tier (with qty 1), there are no actual savings in the list. (tierPrices.Count > 0 && !(tierPrices.Count == 1 && tierPrices[0].Quantity <= 1)) || //we have more than one variant (productVariants.Count > 1); if (displayFromMessage) { priceModel.OldPrice = null; priceModel.Price = String.Format(_localizationService.GetResource("Products.PriceRangeFrom"), _priceFormatter.FormatPrice(finalPrice)); } else { if (finalPriceBase != oldPriceBase && oldPriceBase != decimal.Zero) { priceModel.OldPrice = _priceFormatter.FormatPrice(oldPrice); priceModel.Price = _priceFormatter.FormatPrice(finalPrice); } else { priceModel.OldPrice = null; priceModel.Price = _priceFormatter.FormatPrice(finalPrice); } } } else { //Actually it's not possible (we presume that minimalPrice always has a value) //We never should get here Debug.WriteLine(string.Format("Cannot calculate minPrice for product variant #{0}", productVariant.Id)); } } } else { //hide prices priceModel.OldPrice = null; priceModel.Price = null; }