public int size() {
return cart.size();
}
public Map<String, Object> getItemInfo(int index) {
ShoppingCartItem item = cart.findCartItem(index);
Map<String, Object> itemInfo = FastMap.newInstance();
itemInfo.put("productId", item.getProductId());
itemInfo.put("description", item.getDescription());
itemInfo.put("quantity", UtilFormatOut.formatQuantity(item.getQuantity()));
itemInfo.put("subtotal", UtilFormatOut.formatPrice(item.getItemSubTotal()));
itemInfo.put("isTaxable", item.taxApplies() ? "T" : " ");
itemInfo.put("discount", "");
itemInfo.put("adjustments", "");
if (item.getOtherAdjustments().compareTo(BigDecimal.ZERO) != 0) {
itemInfo.put("itemDiscount", UtilFormatOut.padString(
UtilProperties.getMessage(PosTransaction.resource,"PosItemDiscount",defaultLocale), Receipt.pridLength[0] + 1, true, ' '));
itemInfo.put("adjustments", UtilFormatOut.formatPrice(item.getOtherAdjustments()));
}
if (isAggregatedItem(item.getProductId())) {
ProductConfigWrapper pcw = null;
pcw = item.getConfigWrapper();
itemInfo.put("basePrice", UtilFormatOut.formatPrice(pcw.getDefaultPrice()));
} else {
itemInfo.put("basePrice", UtilFormatOut.formatPrice(item.getBasePrice()));
}
return itemInfo;
}