📑 Online Shopping Cart System - GUI Version
Project Overview:
This project is a user-friendly Online Shopping Cart System
developed using Python’s Object-Oriented Programming (OOP)
principles and a Tkinter GUI. It enables users to manage a catalog of
physical products, add products to a shopping cart, update
quantities, remove items, and simulate a simple checkout with a
payment method.
Objectives:
• Demonstrate all four pillars of OOP: Encapsulation,
Abstraction,Inheritance, and Polymorphism.
• Provide a clear example of using Python decorators
(@property)
for controlled data access.
• Build a menu-driven, window-based shopping experience
with intuitive interactions.
• Help beginners understand how OOP integrates with GUI
development.
Signi cance:
The system showcases how real-world online shopping platforms
work at a basic level. It serves as a foundation for students and
hobbyists to extend into more complex e-commerce systems with
databases, payment gateways, and web frameworks.
fi
2. Literature Review
Background Study:
E-commerce platforms have revolutionized the way people purchase goods by
providing convenient, self-service interfaces. Core components include product
catalog management, shopping carts, and secure checkout.
Relevant Research & Key Findings:
Studies show that interactive and user-friendly shopping cart systems enhance
customer experience and increase conversion rates. Applying OOP in building
such systems ensures scalability, maintainability, and code reusability. GUI-
based prototypes like this one help test usability before deploying web or mobile
versions.
3. Methodology
Research Design:
This project adopts a prototype development approach — designing,
implementing, and iteratively improving the system to demonstrate both OOP
concepts and GUI integration.
Data Collection Methods:
• User inputs (via simpledialog prompts) simulate real-time data entry for
product details and cart actions.
• Interactive GUI responses and message boxes collect and display user
actions and system feedback.
Data Analysis Techniques:
• Functional testing for each feature (add, update, remove, checkout).
• Code inspection to verify proper use of OOP concepts.
• GUI usability checks to ensure all buttons and dialogs work as
expected.
4. Project Plan
Phase Activities Timeline
Phase 1 Requirement gathering, 1 week
planning system ow
Phase 2 Implement core classes 1 week
(Product, CartItem,
ShoppingCart)
Phase 3 Develop GUI using 1 week
Tkinter and integrate
Phase 4 with logic
Testing and bug xing 2 days
Phase 5 Documentation and nal
report
Milestones:
• ✅ Product and cart classes implemented
• ✅ GUI built with full functionality
• ✅ Tested all user actions
• ✅ Prepared nal deliverables
Resource Allocation:
• Tools: Python 3.x, Tkinter library
• Hardware: Personal computer
• Personnel: Solo student project
fi
fl
fi
fi
5. Results and Discussion
Findings:
• The system successfully demonstrates the use of encapsulation \
through private attributes and @property decorators.
• Abstraction is shown by hiding complex operations within simple GUI
actions.
• The GUI works smoothly for adding products, managing cart items,
and simulating checkout.
Analysis:
• The approach is e ective for small-scale local applications but would need
enhancements (like persistent storage and real payment gateways) for real-
world deployment.
• This prototype can be converted into a web app using frameworks like
Django or Flask.
Implications:
• Provides a reusable base for more advanced e-commerce solutions.
• Serves as a practical example for learning OOP and GUI programming in
Python.
ff
6. Conclusion
This project demonstrates a complete, menu-driven Online Shopping Cart
System using Python OOP and Tkinter. It integrates core programming
concepts with a functional user interface, bridging the gap between theoretical
learning and real-world application development. It lays the groundwork for
future improvements, including database integration, user authentication, and
online payment processing.
7. References
1. Python Documentation: https://docs.python.org/3/
2. Tkinter GUI Programming: https://docs.python.org/3/library/tk.html
3. Object-Oriented Programming Principles
CODE
These lines import Tkinter, Python’s built-in library for creating windows and GUI elements,
and give it the short name tk for convenience. They also import messagebox (for pop-up
alerts) and simpledialog (for input dialogs) to interact with the user in the shopping cart
system.
This de nes the Product class, which represents each physical item in the catalog. It
demonstrates Encapsulation by using private variables (like _product_id) and Abstraction by
providing controlled access through @property decorators. The constructor __init__ initializes
the product’s ID, name, price, and available stock.
fi
This part uses @property
decorators to securely access and
modify private product details,
showing Encapsulation.
•The quantity_available has a
setter to safely update stock
without negative values.
•Methods like decrease_quantity
and increase_quantity manage
stock changes during sales and
restocking.
• The display method returns a neat string with the product’s ID, name, price, and stock for
easy catalog display.
• Overall, this ensures data safety and hides internal logic, demonstrating Abstraction.
The CartItem class stores a product and the quantity the user wants to buy.
It includes a subtotal method to calculate the total price for that item (price × quantity).
This helps manage individual cart items separately from the product catalog.
The ShoppingCart class manages the product catalog and the shopping cart using
dictionaries.
• It ensures Encapsulation by handling product IDs, adding products, and managing cart
items internally.
• Methods like generate_product_id, add_product, and add_to_cart simplify catalog
management and safely update stock when users add items to the cart.
• This hides complex logic from the user, showing Abstraction.
These methods manage the shopping cart’s contents and total cost.
• update_cart_quantity adjusts the quantity of an item in the cart while safely updating product
stock.
• remove_from_cart deletes an item from the cart and restores its stock in the catalog.
• get_cart_total calculates the total price, and clear_cart empties the cart after checkout.
The ShoppingCartApp class builds the Tkinter GUI for the shopping cart system.
• It connects the ShoppingCart logic with buttons and text areas, letting users easily add
products, manage the cart, and checkout.
• The GUI hides internal details and provides a simple, user-friendly interface — showing
Abstraction in action.
• Buttons trigger different features like adding products, viewing the catalog, and placing
orders.
These methods handle what happens when users click GUI buttons.
• add_product_ui collects product details and adds them to the catalog.
• show_catalog displays all products in the output area.
• add_to_cart_ui lets the user select a product by ID and quantity, adds it to the cart, and
shows success or error messages if needed.
These methods handle other important cart actions through the GUI.
• update_cart_quantity_ui lets users change the quantity of an item already in the cart.
• view_cart shows all current cart items with quantities and total cost.
• remove_from_cart_ui deletes an item from the cart, and checkout simulates payment, clears
the cart, and con rms the order.
This part runs the program when the le is executed directly.
It creates the main Tkinter window (root), initializes the ShoppingCartApp with it, and starts
the GUI event loop with root.mainloop().
This keeps the app running, waiting for user actions like button clicks.
fi
fi
Acknowledgement
I would like to express my sincere gratitude to NOIDA INSTITUTE OF ENGINEERING
AND TECHNOLOGY for allowing me to work on ONLINE SHOPPING CART. I am
grateful to my Mentor MR. VIKASH TRIPATHI for their guidance and support
throughout the project. I also acknowledge the contributions of colleagues who
helped me complete this project.
Thank you all for your support and encouragement.
Sincerely,
[PRIYANSHU CHAUDHARY]
[VIRAT VARONIYA]
[TANISHK KUMAR]
Certificate
This is to certify that______________________________________________________has
successfully completed ONLINE SHOPPING CART PROJECT in CYBER SECURITY at
NOIDA INSTITUTE OF ENGINEERING AND TECHNOLOGY.
Date: ________
Signature: __________
Designation:____________
OUTPUT
1) Add Products
Product Name Price (₹) Quantity
Notebook 50 100
Pencil Box 80 50
Water Bottle 120 30
2) Show Catalog
Click 📋 Show Catalog
🔹 Step 3: Add Items to Cart
Use 🛒 Add to Cart button
🔹 Step 4: View Cart
Click 🧾 View Cart
STEP5: UPDATE CART QUANTITY
USE ✏ AND CHANGE
PID001:— → Quantity to 4
🔹 Step 6: Remove from Cart
Click ❌ Remove Item, enter PID003
🔹 Step 7: Checkout
Click ✅ Checkout