Untitled
unknown
plain_text
2 years ago
806 B
5
Indexable
# Admin - Change Order Status
def admin_change_order_status():
try:
admin_view_orders_with_status()
order_id = int(input("Enter Order ID to change status: "))
cur.execute("SELECT OrderID FROM Orders")
data = cur.fetchall()
if (order_id,) in data:
new_status = input("Enter 'Pending' or 'Delivered': ").capitalize()
cur.execute("UPDATE Customer_Orders_Admin SET Status = %s WHERE OrderID = %s",
(new_status, order_id))
con.commit()
print(f"Order ID {order_id} status changed successfully!")
else:
print('Sorry, this order does not exist.')
except (mysql.connector.Error, ValueError) as err:
print(f"Error: {err}")
con.rollback()
Editor is loading...
Leave a Comment