• Welcome to KonaKart Community Forum. Please login or sign up.
 

How to refresh the Cart page

Started by Rox, April 16, 2008, 02:27:55 pm

Previous topic - Next topic

Rox

Hi,

I am trying to add Products to cart using API's from other application.

And I want to refresh the cart once they are added if the cart is open.

Is there any event to trigger?

Please let me know how to refresh the cart?

Thanks,
Rox

pete

Hi,

Take a look at EditCartSubmitAction.java to see how the client API can be used. If you use kkAppEng.getBasketMgr().updateBasket(b, /* refresh */true) then the basket will be refreshed. Also if you call kkAppEng.getBasketMgr().getBasketItemsPerCustomer() the basket is refreshed.

Rox

Hi,

If I kkAppEng.getBasketMgr().updateBasket(b, /* refresh */true) i am getting the following exception.

com.konakart.app.KKException: The basket item (id=0) does not belong to the customer (id=2)

But I am using the same basket object which i used to addtoCart function

pete

The id is 0. You need to fill that in with the id of basket item which is generated at creation time.

Rox

Hi,

I am using following code to add item to cart.

         BasketIf b = new Basket();
         b.setQuantity(1);
         b.setProductId(selectedProd.getId());
         kkAppEng.getBasketMgr().addToBasket(b, /* refresh */true);
         kkAppEng.getBasketMgr().updateBasket(b, /* refresh */true)

Am I missing any thing?

And even if the basket is updated I think i need to refresh the browser.I want the browser gets refreshed automatically(by calling any method ).
Thanks,
Rox


pete

         BasketIf b = new Basket();
         b.setQuantity(1);
         b.setProductId(selectedProd.getId());
         kkAppEng.getBasketMgr().addToBasket(b, /* refresh */true);

should work since it is what we use in AddToCartFromProdIdAction.java

The KonaKart API methods won't refresh the browser.

Rox

I know the API's wont refresh the page.
I am looking for the Ajax/javascript method which konakart is using so i can call that to refresh.
Is there any method like that.

Thanks,
Rox

pete

QuoteI am looking for the Ajax/javascript method which konakart is using so i can call that to refresh.


KonaKart isn't using any Ajax/javascript method to refresh the page when something is added to the cart. A struts action class is called which updates all of the relevant data and then a JSP redraws the page picking up the new data.