Part 2: Python Programming
For this part you will be adding an order form to your Assignment 2 website. Do not directly edit your assignment 2 files. Instead, make a copy of the files in your assignment2 folder and place them in your assignment3 folder. You will edit the navigation in your assignment3 files such that it is now possible to order your products from your business website
You will be creating an order form in HTML. This order form should be processed by the Python script you will write in order to produce a receipt for the user of your website.
HTML Order Form Requirements
The order form must contain:
Customer name.
Customer Email address.
Customer address including: street address, city, province (max of 2 characters), and postal code (max of 6 characters).
Credit card information including: type (MC, AMEX, etc.), 16 digit credit card number, and expiration date.
A list of products availbe for sale and their price. Users should be able to order between 0 and 999 of each item. You must have at least 5 products.
You must provide an option for gift-wrapping. If selected, all items will be gift-wrapped.
You must provide an option which allows users to receive an email notification, either when their product has shipped, their order has been processed, or when there are new product updates.
A submit button.
The order form should be clearly organized
You shoud use colour, company logo, etc.
You may use the stylesheets from your assignment 2, create a new stylesheet for the order form and receipt, or use an internal stylesheet. Remember to keep the colours similar to that of the rest of your website, as it should appear to be part of your previous work. However, order forms and receipts often have light coloured backgrounds. This is a good choice.
Your order form must validate XHTML 1.0 Strict.
Python Requirements
You must write a Python script which executes when the user presses the submit button on your order form.
This script should produce a receipt for the user with the following information:
Customer name.
Customer Email address.
Shipping address.
Credit card information with the credit card type, expiration date, and credit card number with the following format: xxxx-xxxx-xxxx-1234 where the "1234" is the last 4 digits of their entered credit card.
The products they ordered with name, quantity, unit price, and total price. For instance, if they order 2 t-shirts at $10 a piece, you need to display the t-shirts, $10 per piece, 2 pieces ordered, and a total of $20.
If the user selects gift-wrapping, add $1 to their bill for each item ordered. If they order 2 t-shirts and 3 coffee cups, the total cost of gift-wrapping is $5.
If the user spends more than $150, you must apply a 15% discount to their pre-taxed total (and before being gift-wrapped).
If the user is from BC, you should apply a 12% sales tax to the cost of their goods (after gift-wrapping and discount where applicable). Any other province has a 6% sales tax.
You must display the following prices on the receipt clearly labeled:
- All information from item 5 above
- Total value of goods purchased (before tax, gift-wrapping, shipping, and discount)
- Amount of discount
- Cost for gift-wrapping
- Amount of taxes
- Cost for shipping
- Total cost for the purchase.
The Python script must output valid XHTML 1.0.
The resulting web page must be clearly organized, use some colour and perhaps company logo, and be easy to understand.
Feel free to use the same stylesheet as you had for assignment 2 or to write a new one.
You must write at least 2 functions.
When the user enters their province you should be able to correctly handle input in any combination of lower and uppercase characters.
For example, BC, Bc, bC, bc, ON, On, oN, on
If the user selected email notification, you must print the appropriate notice.
For instance if the user chose to have an email notification that their order has shipped, display on the receipt "You will be notified when your order has shipped".
A "thank you" for purchasing goods from your site.
Miscellaneous
General Requirements
Upload all files to the CMPT165 server.
All your files should be in a folder called assignment3.
Submit the URL of the main page of your web-site as part of your assignment submission to the submission server. You will also submit the Python web-script you wrote to the submission server.
Notes
You may use tables to lay out your form and to lay out the receipt if you'd like.
You should provide navigation links from your order form back to your website. The easiest method is simply to include the navigation bar from your assignment 2 on the order form itself. This should also probably be included on the receipt.
Use triple-quotes to print large blocks of HTML in your python script, instead of a long series of print statements.
Get started soon, and get help if needed.