From the category page
e.g. http://www.inkredible.co.uk/c/414/canon-pgi-525-cli-526-and-compatibles
The "From" prices doesn't look at the lowest tier price for the customer role which gives the customer inaccurate information.
Darren
model.Price = String.Format(_localizationService.GetResource("Products.PriceRangeFrom"), _priceFormatter.FormatPrice(finalPrice));
if (product.ProductVariants.Count > 0)
{
model.OldPrice = null;
model.Price = String.Format(_localizationService.GetResource("Products.PriceRangeFrom"), _priceFormatter.FormatPrice(finalPrice));
}
protected ProductModel.ProductPriceModel PrepareProductPriceModel(Product product)
{
if (product == null)
throw new ArgumentNullException("product");
var model = new ProductModel.ProductPriceModel();
var productVariants = _productService.GetProductVariantsByProductId(product.Id);
switch (productVariants.Count)
{
case 0:
{
//no variants
model.OldPrice = null;
model.Price = null;
}
break;
default:
{
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)
{
model.OldPrice = null;
model.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);
decimal oldPrice = _currencyService.ConvertFromPrimaryStoreCurrency(oldPriceBase, _workContext.WorkingCurrency);
decimal finalPrice = _currencyService.ConvertFromPrimaryStoreCurrency(finalPriceBase, _workContext.WorkingCurrency);
//do we have tier prices configured?
var tierPrices = productVariant.TierPrices
.OrderBy(tp => tp.Quantity)
.ToList()
.FilterForCustomer(_workContext.CurrentCustomer)
.RemoveDuplicatedQuantities();
if (tierPrices.Count > 0 && !(tierPrices.Count == 1 && tierPrices[0].Quantity <= 1))
{
//When there is just one tier (with qty 1), there are no actual savings in the list.
model.OldPrice = null;
model.Price = String.Format(_localizationService.GetResource("Products.PriceRangeFrom"), _priceFormatter.FormatPrice(finalPrice));
}
else
{
if (product.ProductVariants.Count > 0)
{
model.OldPrice = null;
model.Price = String.Format(_localizationService.GetResource("Products.PriceRangeFrom"), _priceFormatter.FormatPrice(finalPrice));
}
else
{
if (finalPriceBase != oldPriceBase && oldPriceBase != decimal.Zero)
{
model.OldPrice = _priceFormatter.FormatPrice(oldPrice);
model.Price = _priceFormatter.FormatPrice(finalPrice);
}
else
{
model.OldPrice = null;
model.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("PrepareProductPriceModel with minPrice not set. Variant ID = {0}", productVariant.Id));
}
}
}
else
{
//hide prices
model.OldPrice = null;
model.Price = null;
}
}
break;
}
//'add to cart' button
switch (productVariants.Count)
{
case 0:
{
// no variants
model.DisableBuyButton = true;
}
break;
case 1:
{
//only one variant
var productVariant = productVariants[0];
model.DisableBuyButton = productVariant.DisableBuyButton || !_permissionService.Authorize(StandardPermissionProvider.EnableShoppingCart);
if (!_permissionService.Authorize(StandardPermissionProvider.DisplayPrices))
{
model.DisableBuyButton = true;
}
}
break;
default:
{
//multiple variants
model.DisableBuyButton = true;
}
break;
}
return model;
}