BigDecimal quantity = item.getQuantity();
BigDecimal unitPrice = item.getBasePrice();
BigDecimal subTotal = unitPrice.multiply(quantity);
BigDecimal adjustment = item.getOtherAdjustments();
XModel line = Journal.appendNode(model, "tr", ""+cart.getItemIndex(item), "");
Journal.appendNode(line, "td", "sku", item.getProductId());
Journal.appendNode(line, "td", "desc", item.getName());
Journal.appendNode(line, "td", "qty", UtilFormatOut.formatQuantity(quantity));
Journal.appendNode(line, "td", "price", UtilFormatOut.formatPrice(subTotal));
Journal.appendNode(line, "td", "index", Integer.toString(cart.getItemIndex(item)));
if (this.isAggregatedItem(item.getProductId())) {
// put alterations here
ProductConfigWrapper pcw = null;
// product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
// pcw = new ProductConfigWrapper(delegator, session.getDispatcher(), productId, null, null, null, null, null, null);
pcw = item.getConfigWrapper();
List selected = pcw.getSelectedOptions();
Iterator iter = selected.iterator();
while (iter.hasNext()) {
ConfigOption configoption = (ConfigOption)iter.next();
if (configoption.isSelected()) {
XModel option = Journal.appendNode(model, "tr", ""+cart.getItemIndex(item), "");
Journal.appendNode(option, "td", "sku", "");
Journal.appendNode(option, "td", "desc", configoption.getDescription());
Journal.appendNode(option, "td", "qty", "");
Journal.appendNode(option, "td", "price", UtilFormatOut.formatPrice(configoption.getPrice()));
Journal.appendNode(option, "td", "index", Integer.toString(cart.getItemIndex(item)));
}
}
}
if (adjustment.compareTo(BigDecimal.ZERO) != 0) {
// append the promo info
XModel promo = Journal.appendNode(model, "tr", "itemadjustment", "");
Journal.appendNode(promo, "td", "sku", "");
Journal.appendNode(promo, "td", "desc", UtilProperties.getMessage(PosTransaction.resource,"PosItemDiscount",defaultLocale));
Journal.appendNode(promo, "td", "qty", "");
Journal.appendNode(promo, "td", "price", UtilFormatOut.formatPrice(adjustment));
}