List<GenericValue> curVariantPriceList = EntityUtil.filterByDate(delegator.findByAndCache("ProductPrice", UtilMisc.toMap("productId", curVariantProductId), UtilMisc.toList("-fromDate")), nowTimestamp);
List<GenericValue> tempDefaultPriceList = EntityUtil.filterByAnd(curVariantPriceList, UtilMisc.toMap("productPriceTypeId", "DEFAULT_PRICE"));
GenericValue curDefaultPriceValue = EntityUtil.getFirst(tempDefaultPriceList);
if (curDefaultPriceValue != null) {
BigDecimal curDefaultPrice = curDefaultPriceValue.getBigDecimal("price");
if (minDefaultPrice == null || curDefaultPrice.compareTo(minDefaultPrice) < 0) {
// check to see if the product is discontinued for sale before considering it the lowest price
GenericValue curVariantProduct = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", curVariantProductId));
if (curVariantProduct != null) {
Timestamp salesDiscontinuationDate = curVariantProduct.getTimestamp("salesDiscontinuationDate");
if (salesDiscontinuationDate == null || salesDiscontinuationDate.after(nowTimestamp)) {