A basic e-commerce app.
- Initialize the project
- Initialize Store App
- Add store app reference in the setting.py of main project
- Create template files for store app
- Create views - Store, Cart, Checkout
- Create the urls in urls.py file of Store app
- Include store urls in the main project urls.py
- Create a static folder outside main project and Store app
- Create two folder for css and images in static directory
- Add static folder reference in settings.py within STATICFILES_DIRS list
- Then add main.css in the main.html file of store app
- Design html files for frontend of store app
- Create database models:
- Customer
- Product
- Order
- OrderItem
- ShippingModel
- Database migration
- Register models
- Create a super user
- Add 6 dummy products from admin panel
- Fetch products dynamically from database using store function in views.py
- Creating for loop in store.html render products
- For showing images of products
- Install pillow
- Create imagefield in Prodcut model
- Migrate database
- Make MEDIA_DIR as static/images/products
- Make MEDIA_URL
- Modify urlpatterns in urls.py of main project
- Creating a function in product model to return image url
- For creating user cart
- Create dummy user from admin panel
- Create dummy order and orderitems from admin panel
- Fetch orders dynamically from database using cart function in views.py
- Creating for loop in cart.html render orders
- To get total price of cart items and number of total items
- Create function get_total in OrderItem model which return total price
- Implement that total price for each product in html
- Create two functions in Order model to get total number of items and total price
- Pass order in the context of cart function of views.py
- Implement data in html
- To get total price and number of items follow step 22 and change
- checkout.html
- checkout function in views.py
- Now to create 'ADD TO CART' functionality
- Create cart.js file in static js folder
- Pass data-product and data-action attributes in 'ADD TO CART' button in HTML
- Now check if user is logged in or not
- If user is logged in we will send data
- For sending data got to views.py and create function updateItem
- Creat pipeline for updateitem and send a dummy message as response
- Create function in cart.js to post items and get a response
- Now create function in main.html within script tag to get CSRF token
- Now pass that token as headers attribute
- Now modify updateitem function in view.py to add or remove products
- Now to render number of cart items
- Modify all the view functions in views.py and pass cartItems to html file
- Place cartItems at particular position
- Now to update the number of items from cart page on clicking arrow keys
- Add class name 'update-cart' to the up/down arrow buttons
- Pass attribute data and data-action
- Now make payment option visible on submitting the form on checkout page
- Make shipping details form interactive
- To make an order create a function in view.py and pass data to database