if(StringUtils.isNotEmpty(quantity)){
quantityValue = Integer.parseInt(quantity);
}
webManagementService.addToCart(requestData, catalogCategoryCode, productSkuCode, quantityValue);
CartPojo cart = checkoutPojoService.handleCartMapping(requestData.getCart(), requestData.getVirtualCatalogCode(), requestData.getMasterCatalogCode());
for (Iterator<CartItemPojo> iterator = cart.getCartItems().iterator(); iterator.hasNext();) {
CartItemPojo cartItem = (CartItemPojo) iterator.next();
if(cartItem.getProductSku().getCode().equals(productSkuCode)){
addToCart.setQuantity(cartItem.getQuantity());
}
}
if(cart != null && cart.getCartItems() != null){
if (cart.getCartItems().size() == 1) {
addToCart.setCheckoutShoppingCartHeaderLabel(getSpecificMessage(ScopeWebMessage.COMMON, "cart_total_summary_label_one_item", locale));
} else if (cart.getCartItems().size() > 1) {
Object[] cartTotalSummaryLabelParams = { cart.getCartItems().size() };
addToCart.setCheckoutShoppingCartHeaderLabel(getSpecificMessage(ScopeWebMessage.COMMON, "cart_total_summary_label_many_items", cartTotalSummaryLabelParams, locale));
} else {
addToCart.setCheckoutShoppingCartHeaderLabel(getSpecificMessage(ScopeWebMessage.COMMON, "cart_total_summary_label_no_item", locale));
}