KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: rgayle on April 15, 2009, 05:51:13 am

Title: Adding multiple products to the cart
Post by: rgayle on April 15, 2009, 05:51:13 am
the following code supposed to add two items to the shopping cart, but when I'm forwarded to the cart page, there is only one product, the second of the two.

               BasketMgr bm = kkAppEng.getBasketMgr();
               for (ProductIf bundleProd : kkAppEng.getProductMgr().getBundledProducts()) {
                    BasketIf b = new Basket();
                    b.setQuantity(Math.max(bundleProd.getQuantity(),1));
                    b.setProductId(bundleProd.getId());
                    bm.addToBasket(b,true);
                  }

what am I doing wrong?
Title: Re: Adding multiple products to the cart
Post by: trevor on April 15, 2009, 08:15:29 am
Are you sure that there are two products? Have they both been added to the database? Try adding them manually through the application and see if it works.
Title: Re: Adding multiple products to the cart
Post by: rgayle on April 15, 2009, 07:57:40 pm
Thanks, I had not put this logic into the other AddtoCart java class.  (AddToCartSubmit) something like that.  Also, If I'd read the cart entries description of the product, I would have realized that it was not one of the ingredients, but the actual recipe product.

Thanks.