Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing a Shopping Cart [closed]

I am making an Android app where I am implementing a Shopping Cart. When the user selects an item, it is added to his/her shopping cart/bag in the app. Once he/she adds an item, he's presented with the menu again, where he can add more items. Now I want to know how do I save these items during the buying process. I mean the items that are being saved in the bag, how do I save them in my android app? Shall I use the Android SQLite database? or use putextra/getextra and navigate through activities? or shall I use Global Variables (something like subclassing the Application class)?

Or is there any other better way to implement such a thing? The details that I need to show in my bag are: the name of the product, its price, quantity and a few other attributes/options related to the product.

like image 534
kb_14 Avatar asked Jun 30 '12 06:06

kb_14


People also ask

What are the effects of shopping cart abandonment?

A high number of abandoned carts can take up server bandwidth and significantly slow down your website, which is a major problem for your customer experience. A slow website can be incredibly frustrating to customers, causing them to give up or do their shopping elsewhere.


3 Answers

Passing the shopping cart items around in extras or using an Application class is too volatile. If your app crashes, the user exits the app, android decides to close your app, .. basically anything that closes your app.. The user will lose the contents of their shopping cart.

SQLite would be a good option for storing data like this. You could also store the shopping cart in an xml file on the user's phone.

like image 117
dymmeh Avatar answered Nov 11 '22 04:11

dymmeh


Is there any other better way to implement such a thing?

First of all you have to understand that what is Shopping Cart Software? However you may develop shopping cart client (Tutorials) in android.

The shopping cart system has server-application (which you may develop using the RESTful web-services,servlets and filter) and client-application (you may develop a web-client or Android client). The RESTful web-services, which expose Shopping Cart API and you may interact them (Web-services) with Android UI and network API (Apache http client).

like image 44
KV Prajapati Avatar answered Nov 11 '22 05:11

KV Prajapati


One way is to have your shopping cart stored in a public static variables. Since I had to implement the shopping cart for few of my Android apps, I have tried to create a library project for it.

You can check it out here: https://github.com/tonyvu2014/android-shoppingcart and an example on how to use the library is here: https://github.com/tonyvu2014/android-shoppingcart-demo

like image 2
Tony Vu Avatar answered Nov 11 '22 06:11

Tony Vu