├── Fashion.py └── README.md /Fashion.py: -------------------------------------------------------------------------------- 1 | dress=[{"id":1001,"Name":"Tops","Available":10,"Price":250,"Original_Price":200}, 2 | {"id":1002,"Name":"Pants","Available":12,"Price":500,"Original_Price":450}, 3 | {"id":1003,"Name":"Sarees","Available":100,"Price":750,"Original_Price":700}, 4 | {"id":1004,"Name":"Shorts","Available":20,"Price":350,"Original_Price":300}, 5 | {"id":1005,"Name":"Kurtas","Available":15,"Price":400,"Original_Price":300}] 6 | dress1=dress 7 | temp=[] 8 | order="" 9 | 10 | 11 | def adminLogin(): 12 | print("*********************") 13 | print("1.Display Menu") 14 | print("2.Add item") 15 | print("3.Remove item") 16 | print("4.Total goods available") 17 | print("5.Income and Loss") 18 | print("6.Logout") 19 | print("*********************") 20 | 21 | 22 | def adminDisplayMenu(): 23 | print("Id\tName\tAvailable\tPrice\tOriginal Price") 24 | print("***************************************************") 25 | for d in dress: 26 | print(f'{d["id"]}\t{d["Name"]}\t{d["Available"]}\t\t{d["Price"]}\t{d["Original_Price"]}') 27 | 28 | 29 | def addItem(): 30 | n=int(input("Enter the no.of.items need to be added : ")) 31 | for i in range(n): 32 | new_id=int(input("Enter id : ")) 33 | new_Name=input("Enter Name : ") 34 | new_Available=int(input("Enter Available : ")) 35 | new_Price=int(input("Enter Price : ")) 36 | new_original=int(input("Enter the original price : ")) 37 | d=[{"id":new_id,"Name":new_Name,"Available":new_Available,"Price":new_Price,"Original_Price":new_original}] 38 | dress.extend(d) 39 | adminDisplayMenu() 40 | 41 | def removeItem(): 42 | 43 | dressId=int(input("Enter the id need to be deleted : ")) 44 | found=False 45 | for d in dress1: 46 | found=d["id"]==dressId 47 | if found !=True: 48 | temp.append(d) 49 | continue 50 | if found==True: 51 | d["Available"]-=1 52 | print("Deleting item....") 53 | if len(temp)==d: 54 | print(f"{dressId} not found") 55 | else: 56 | print(f"{dressId}'s one available is removed from the list") 57 | adminDisplayMenu() 58 | def goods(): 59 | Total=0 60 | print("\n") 61 | for d in dress: 62 | print(f'{d["Name"]} = {d["Available"]}') 63 | Total+=(d["Available"]) 64 | print("\nTotal available goods is : ",Total) 65 | def incomeLoss(): 66 | total=0 67 | for d in dress: 68 | total+=((d["Available"]*d["Price"])-(d["Available"]*d["Original_Price"])) 69 | print("\nTotal income or loss is : ",total) 70 | 71 | def logout(): 72 | login() 73 | 74 | 75 | 76 | def adminChoice(): 77 | choice=int(input("Please enter user choice : ")) 78 | if choice==1: 79 | adminDisplayMenu() 80 | print("\n***************************************************\n") 81 | adminLogin() 82 | print("\n***************************************************\n") 83 | adminChoice() 84 | elif choice==2: 85 | adminDisplayMenu() 86 | print("\n***************************************************\n") 87 | addItem() 88 | print("\n***************************************************\n") 89 | adminLogin() 90 | print("\n***************************************************\n") 91 | adminChoice() 92 | elif choice==3: 93 | adminDisplayMenu() 94 | print("\n***************************************************\n") 95 | removeItem() 96 | print("\n***************************************************\n") 97 | adminLogin() 98 | print("\n***************************************************\n") 99 | adminChoice() 100 | elif choice==4: 101 | goods() 102 | print("\n***************************************************\n") 103 | adminLogin() 104 | print("\n***************************************************\n") 105 | adminChoice() 106 | elif choice==5: 107 | incomeLoss() 108 | print("\n***************************************************\n") 109 | adminLogin() 110 | print("\n***************************************************\n") 111 | adminChoice() 112 | elif choice==6: 113 | logout() 114 | else: 115 | print("\nInvalid Choice. Please enter valid choice") 116 | print("\n***************************************************\n") 117 | adminLogin() 118 | print("\n***************************************************\n") 119 | adminChoice() 120 | 121 | 122 | 123 | 124 | 125 | def userLogin(): 126 | print("*********************\n") 127 | print("1.Display Menu") 128 | print("2.Place order") 129 | print("3.Cancel order") 130 | print("4.Logout") 131 | print("\n*********************") 132 | def userDisplayMenu(): 133 | print("Id\tName\tAvailable\tPrice") 134 | print("***************************************************") 135 | for d in dress: 136 | print(f'{d["id"]}\t{d["Name"]}\t{d["Available"]}\t\t{d["Price"]}') 137 | def user_id(): 138 | userDisplayMenu() 139 | p_id=int(input("\nEnter the id : ")) 140 | def placeOrder(): 141 | order_number=10 142 | userDisplayMenu() 143 | p_id=int(input("\nEnter the id : ")) 144 | 145 | for d in dress: 146 | if d["id"]==p_id: 147 | print("\nId\tName\tAvailable\tPrice") 148 | print("***************************************************") 149 | print(f'{d["id"]}\t{d["Name"]}\t{d["Available"]}\t\t{d["Price"]}') 150 | order='{d["id"]}\t{d["Name"]}\t{d["Available"]}\t\t{d["Price"]}' 151 | conform=input("\nDo you want to place an order on the above shown product : Y/N ") 152 | 153 | if conform=='Y' or conform=='y': 154 | print("\nSuccessfully placed the order on the product {} {}".format(d["id"],d["Name"])) 155 | order_number+=1 156 | print("Your order number is : ",order_number) 157 | d["Available"]-=1 158 | break 159 | 160 | elif conform=='N' or conform=='n' : 161 | print("The order is not placed. You can carry on with you purchase. Happy shopping!!!!") 162 | break 163 | else: 164 | print("\nYou have entered wrong option. Please enter again\n") 165 | conform=input("\nDo you want to place an order on the above shown product : Y/N ") 166 | break 167 | 168 | 169 | if d["id"]!=p_id: 170 | print("\nYou have entered invalid id. Please enter valid id\n") 171 | user_id() 172 | print("\nAvailable products : \n") 173 | userDisplayMenu() 174 | 175 | def cancelOrder(): 176 | found=False 177 | temp=[] 178 | order_id=input("Enter the order id : ") 179 | for d in dress: 180 | found=d["id"]==order_id 181 | if found!=True: 182 | temp.append(d) 183 | if len(temp)==d: 184 | print(f'{order_id} is not found') 185 | else: 186 | print(f'{order_id} is removed from the placed order') 187 | 188 | def userChoice(): 189 | choice=int(input("Please enter user choice : ")) 190 | if choice==1: 191 | userDisplayMenu() 192 | print("\n***************************************************\n") 193 | userLogin() 194 | print("\n***************************************************\n") 195 | userChoice() 196 | elif choice==2: 197 | placeOrder() 198 | print("\n***************************************************\n") 199 | userLogin() 200 | print("\n***************************************************\n") 201 | userChoice() 202 | elif choice==3: 203 | cancelOrder() 204 | print("\n***************************************************\n") 205 | userLogin() 206 | print("\n***************************************************\n") 207 | userChoice() 208 | elif choice==4: 209 | logout() 210 | else: 211 | print("Invalid Choice. Please enter valid choice") 212 | 213 | 214 | def login(): 215 | tp=input("Admin/User [A/U] : ") 216 | if tp=='A' or tp=='a' : 217 | password=input("Enter the password : ") 218 | if password=="abc": 219 | adminLogin() 220 | adminChoice() 221 | else: 222 | print("Invalid password. Please enter valid password") 223 | 224 | elif tp=='U' or tp=='u': 225 | password=input("Enter the password : ") 226 | if(password=="123"): 227 | userLogin() 228 | userChoice() 229 | else: 230 | print("Invalid password. Please enter valid password") 231 | else: 232 | print("Invalid user type. Enter valid user type") 233 | login() 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Online-Shopping-System-using-python 2 | Online shopping cart 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Modules: 16 | 17 | 18 | 1) Login/Logout 19 | 2) Display Menu 20 | 3) Add/Remove item 21 | 4) Total goods available 22 | 5) Income/Loss 23 | 6) Place order 24 | 7) Cancel order 25 | --------------------------------------------------------------------------------