def view_category_items(category): try: ''' Validate the user input ''' list_of_category_items=Validate.validate_view_category_items(category) ''' Print the details ''' for product in list_of_category_items: print(product.get_product_id()," ",product.get_product_name()," ",product.get_price()) print() #Getting valid item from the displayed items for the selected category item_selected=input("Enter a Items for order: ") print() category_items = [] category_items_quantity = [] #Splitting the category with respect to multiple items selected category_items = category.split(',') quantity_req =input("Enter a quantity required : ") #Splitting the category with respect to multiple items selected category_items_quantity = quantity_req.split(',') for index , category in zip(category_items , list_of_category_items) : print(index ," ", category) print() choice=input("Please Select The Category. Enter Corresponding Number ") if(choice=="1"): category_id=input("Enter the Category ID") ''' Here we are invoking a dummy function and passing the data to it. This dummy function has to be completed by another programmer. ''' elif(choice=="2"): category_id=input("Enter the Category ID") ''' Here we are invoking a dummy function and passing the data to it. This dummy function has to be completed by another programmer. ''' elif(choice=="3"): category_id=input("Enter the Category ID") ''' Here we are invoking a dummy function and passing the data to it. This dummy function has to be completed by another programmer. ''' elif(choice=="4"): category_id=input("Enter the Category ID") ''' Here we are invoking a dummy function and passing the data to it. This dummy function has to be completed by another programmer. ''' elif(choice=="5"): category_id=input("Enter the Category ID") '''
def view_category_items(category): global category_items global category_items_quantity try: ''' Validate the user input & get Restaurant name from Class Global Variables ''' restaurant_name = FoodModule.Food.restaurant_name list_of_category_items=Validate.validate_view_category_items(category,restaurant_name) # print("Printing restaurant name accessed from FoodModule.Food.restaurant_name ") # print(restaurant_name) # print("After List_of_category_items=Validate.val") ''' Print the food items details ''' print("FoodName \t Price \t Availability") for item in list_of_category_items: print(item.get_food_name(),"\t",item.get_price(),"\t",item.get_availability()) print() ''' Calling the function defined below ''' enter_food_items() availability_view(category_items) enter_food_quantity() ''' Printing Dictionary #print("Printing Dictionary") ''' print("FoodName \t Quantity") for index , value in FoodModule.Food.cart_dict.items() : print(index , " \t" ,value) ''' WIll call them later after debugging next function #Temporary hardcoding for easy debugging # username = "******" # Checkout.checkout(username) ''' ''' Calling Class Checkout for further processing ''' username = FoodModule.Food.registered_user Checkout.checkout(username) print() ''' Handle all the exceptions that can occur ''' except InvalidCategoryException as e: print(e) except InvalidCatItemsException as e: print(e) except Exception as e: #Will edit the Error messages in View functions print("Sorry. Some system error occurred.") print(e) finally : pass