SIZ TUTORIAL - ONLINE SHOPPING CART (PART 1)

in hive-181430 •  3 years ago 


20% of the payout will be in @siz-official 's wallet



Hey steemit people!!

Hope you're fine and doing good here and as wel as in your personal life. It's been a while I havent share anthing or any tutorial with you. Today I am discussing the project that I made recently that was online shopping cart. The project is made using the python language and completly on CLI. In this post I will be covering only login and signup method while other or remaing portion of this project will be disscussed on another post as continuition.


PROBLEM DESCRIPTION:

Online shopping cart is a virtual shopping trolley, where shoppers can put all of
their want-to-buy products in, review to make adjustments in quantity, product
attributes, etc., and remove it before or during the checkout if they change their
mind.

FEATURES OF OUR SHOPPING CART:

• We used database SQLite which helps in maintaining the records easily and properly as
well.
• It has permanent storage of the users.
• Our shopping cart displays the products.
• It can export from cart.
• You can delete the items that you don’t want from cart.
• You can delete the history.
• It displays the entire history as well along with the time.

FILES IMPORTED

import functions
from datetime import datetime
import sys
import time
from abc import ABC, abstractmethod

CLASS LOGIN

Class login asked us to enter the name, mail, password and then check from the database
whether the credentials are correct or not. If they are not correct, it gives a appropriate
message and if correct then it gives us the options to go to products, export from cart, delete
from cart, delete from history, display history. You can choose any and the program will run
accordingly.


class login:
 def check_id(self):
 global username
 self.name=input("ENTER USERNAME: ")
 self.email=input("ENTER EMAIL: ")
 self.password=input("ENTER PASSWORD: ")
 try:
 flag=0
 for i in self.all_data:
 print(i)
 if (i[1]==self.email) and (i[0]==self.name) and (i[2]==self.passw
ord):
 print(flag)
 flag=1
username=self.name
 if flag==1:
 #go to product or cart:

 try:
 print("what do you want to?")
 print("1.go to product")
 print("2.export from cart ")
 print("3.delete from cart ")
 print("4.delete from history")
 print("5.display history")
 self.want=input("ENTER NUMBER: ")
 if self.want=="1":
 p=all_product()
 elif self.want=="2":
 c=add_to_cart()
 c.export()
 elif self.want=="3":
 r=remove_from_cart()
 r.delete_from_cart()
 elif self.want=="4":
 h=shopping_history()
 h.delete_from_history()
7
 elif self.want=="5":
 h=shopping_history()
 h.display_history()
 else:
 raise ValueError
 except ValueError:
 print("ENTER CORRECT CHOICE")


 else:
 raise ValueError
 except ValueError:
 print("DATA ENTERED WAS INVALID ")
 print("Do you want enter data again or sign up for new account :")
 self.choice=input("FOR ENTERING DATA AGAIN PRESS 1 FOR SIGN PRESS 2 :
")
 if self.choice=="1":
 self.check_id()
 elif self.choice=="2":
 s=sign_up()
 else:
 pass
 def __init__(self):
 self.all_data=self.all=functions.show_all("user.db","user_info")
 self.check_id()

CLASS SIGNUP:

The signup class allows to open an account. It asks some questions and create an account. Your
username, password and an email are required to make an account. After entering the essential
data all the data will go into the database.

class sign_up:
 def pass_aunc(self):
 if self.password == self.pass_check :
 now = datetime.now()
 current_time = now.strftime("%H:%M:%S")
 functions.add_one_data("user.db","user_info",(self.name,self.emai
l,self.password,current_time))
 try:
8
 print("what do you want to?")
 print("1.go to product")
 print("2.EXIT")
 self.want=input("ENTER NUMBER: ")
 if self.want=="1":
 p=all_product()
 elif self.want=="2":
 sys.exit()
 else:
 raise ValueError
 except ValueError:
 print("ENTER CORRECT CHOICE")
 else:
 s=sign_up()
 def __init__(self):
 self.name=input("ENTER USERNAME: ")
 self.email=input("ENTER EMAIL: ")
 self.password=input("ENTER PASSWORD: ")
 self.pass_check=input("ENTER PASSWORD AGAIN:")
 self.pass_aunc()`



THANK YOU FOR VISITING
CATCH YOU ON ANOTHER POST!
WITH BEST REGARDS
COUNTRY REPRESENTATIVE PAKISTAN


You can delegate your SP to @siz-official and take benefit of our Delegation Rewards Offer of getting up to 200% Curation Rewards

You can also use these quick delegation links. Just click on the desired amount of SP you want to delegate, and it will be done in the process of 1 minute.

Quick Delegation to SIZ
50 100 200 300 400 500 1000
2000 3000 4000 5000 10000

Divider 2.png

Steem Infinity Zone Team
@cryptokraze | @arie.steem | @qasimwaqar | @vvarishayy | @suboohi

Footer.png

Click Here to Join Official SIZ Discord Channel

Discord
Twitter
Facebook

Divider 2.png

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

#club5050 😀

Respected mam plz verify my Achievement 3.i shall be very thankful to you.

https://steemit.com/hive-172186/@mudasar01/74qxmf-achievement-3-content-etiquette-by-haron01

Good...👍

This is very informative post

#club5050 😀