boolean hasError = validateUpdateQty(form, getContentBean(request));
if (hasError) {
String itemNaturalKeys[] = form.getItemNaturalKeys();
String itemQtys[] = form.getItemQtys();
for (int i = 0; i < itemNaturalKeys.length; i++) {
ShoppingCartItemBean bean = (ShoppingCartItemBean) form.getShoppingCartItemInfos().elementAt(i);
bean.setItemQty(itemQtys[i]);
}
}
else {
String itemNaturalKeys[] = form.getItemNaturalKeys();
String itemQtys[] = form.getItemQtys();
if (itemNaturalKeys != null) {
for (int i = 0; i < itemNaturalKeys.length; i++) {
int qty = 0;
if (itemQtys[i].trim().length() != 0) {
qty = Format.getInt(itemQtys[i]);
}
Item item = DataApi.getInstance().getItem(site.getSiteId(), itemNaturalKeys[i]);
try {
shoppingCart.setItemQty(item, qty, null, contentBean, true);
} catch (ItemNotAvailiableException itemNotAvailiableException) {
String value = Languages.getLangTranValue(language.getLangId(), "content.text.itemQuatityNotAvailable");
ShoppingCartItemBean itemInfo = (ShoppingCartItemBean) form.getShoppingCartItemInfos().elementAt(i);
itemInfo.setItemQtyError(value);
hasError = true;
}
}
}
if (!hasError) {