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

Accessing KonaKart session programmatically? (Add to cart, # of items in cart)

Started by pmw, May 13, 2011, 09:16:11 pm

Previous topic - Next topic

pmw

Hi, all,

I have an existing web site for a small businesses that statically lists various products for sale. Now I'd like to add KonaKart.

Once the products are added to KonaKart, a visitor would be able to see the static lists of products, but to buy anything online, they would have to hop over to KonaKart, find the product, and add it to their cart.

I would like to add a "Add to Cart" button from the static pages. It would do the obvious. Is this possible? My expectation is that the static products would (at least initially) mirror the products added to the KonaKart database, and the "Add to Cart" button would pass a product ID to some Struts action or to a SOAP function.

To go hand-in-hand with that, I would like to be able to programmatically determine how many items are in the current user's cart to display it on the static pages. (They wouldn't be static anymore, of course.)

KonaKart's documentation has the movie review example, where a programmer dynamically adds recommended products to a JSP page. This is different from what I want because the recommended products are not based on the customer's session. My information is session-specific.

Please advise. Much appreciated.

pmw

Hmm, there's no "edit post" functionality?

I wanted to add: I want the "Add to Cart" button from the static pages to add the item behind the scenes, so to speak -- the action would return the user to the static page they were viewing when they clicked the button.

I imagine if I simply copied the existing "Add to Cart" button from the shopping cart, it would work, but it would take the user to someplace within the KonaKart UI. (Product page? Shopping cart?)

pmw

I did some more research. I see that there's a way I can get shopping cart details of the "default user". I assume this would allow me to display the number of items in cart, and to add to cart from an external site. However, what if a user is already logged into KonaKart? Then wouldn't the "default user" session be inapplicable?

Is there a way to get the correct session ID for my user no matter whether he's logged in or not?