User
User

Reputation: 1363

online shopping application for add cart

I am developing online shopping purchases application so flow of application is

Add or Remove Item from cart => view item in my cart => then payment option

When click on Remove item from Cart I can have two option to remove

1) i will delete that item permanently from database using delete query

2) second way i can make one more row delete-status and update that with true or false

which way I should use for better coding or any other better option than above two.

reference image:

enter image description here

Upvotes: -2

Views: 209

Answers (3)

Raynoceros
Raynoceros

Reputation: 386

Usually the delete action comes with a confirmation box. User wouldn't accidentally remove the item, so I prefer:

1) i will delete that item permanently from database using delete query

Upvotes: -1

Tipu
Tipu

Reputation: 11

Its better to change the status "false", because deleting data from database means loose the details or records, so better to update the status. If you have data into your database you can use it for future by just updating the status.

For example,

you add an item to your cart, then you want to remove it, if you again want to add this item into your cart you have to just update the status active, instead of insert same record again int the row. so its better to just update the status as per your required.

Upvotes: -1

Roman.Pavelko
Roman.Pavelko

Reputation: 1665

I would remove record from DB unless you need it later for some logic/statistics/recommendations.
Keep your code and logic simple as much as possible.

Upvotes: 0

Related Questions