List<GenericValue> productPromos = FastList.newInstance();
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
// get the ShoppingCart out of the session.
HttpServletRequest req = null;
ShoppingCart cart = null;
try {
req = (HttpServletRequest) request;
cart = ShoppingCartEvents.getCartObject(req);
} catch (ClassCastException cce) {
Debug.logError("Not a HttpServletRequest, no shopping cart found.", module);
return null;
} catch (IllegalArgumentException e) {
Debug.logError(e, module);
return null;
}
boolean condResult = true;
try {
String productStoreId = cart.getProductStoreId();
GenericValue productStore = null;
try {
productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", productStoreId));
} catch (GenericEntityException e) {
Debug.logError(e, "Error looking up store with id " + productStoreId, module);
}
if (productStore == null) {
Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId",productStoreId), cart.getLocale()), module);
return productPromos;
}
if (productStore != null) {
Iterator<GenericValue> productStorePromoAppls = UtilMisc.toIterator(EntityUtil.filterByDate(productStore.getRelatedCache("ProductStorePromoAppl", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNum")), true));