190 likes | 209 Views
This article explores the design and development of an interactive web site for BigHit Online, focusing on components, data modeling, and user requirements. It covers topics such as creating a SQL server database, web site design and flow, login and customer information, shopping carts and wish lists, and more.
E N D
Your Name Here See Page Notes for Info about Hyperlinks
Designing an Interactive Web Site • Components of the BigHit Online Web Site • Data Modeling for BigHit Online • Evaluating the E-R Diagram • Improving the ER Diagram • Using Weak Entity Classes for Many-To-Many Relationship Types • Modeling Shopping Carts and Wish Lists • Modeling to Support Searching for Movies • Final Evaluation of the Conceptual Model • Relational Model for BigHit Online • Creating a SQL Server Database • Web Site Design, Pages, and Flow • Login and Customer Information • Shopping Carts, Searching, and Selecting Items • Checkout and Receipt
Components of the BigHit Online Web Site • Statement of purpose • BigHit Video Inc. wants to create an information system for online sales of in both DVD and videotape format. People will be allowed to register as customers of the online site and to update their stored information. Information must be maintained about customers’ shipping addresses, e-mail addresses and credit cards. In a single sale, customers will be allowed to purchase any quantity of videos. The items in a single sale will be shipped to a single address and will have a single credit card charge. • A customer will be provided with a virtual shopping cart to store items to be purchased. As each item is selected, it is added to the shopping cart. When the customer finishes shopping, he will be directed to a checkout area where he can purchase all of the items in the shopping cart. At this time, payment and shipping information is entered. Once the sale is complete, the shopping cart will be deleted and the customer will be sent a receipt by e-mail.
User-side Requirements • The customer side of the Web site must provide these major capabilities: • Customer information: • Allow customers to create and edit their own profiles • To login and logout • Shopping: • Allow customers to search for movies to buy • Select movies and place them in a shopping cart • View and modify the contents of the shopping cart • Checkout: • Allow customers to purchase items in the shopping cart • Specify shipping and method of payment • Receive both an online and an e-mail receipt • Inquiry: • Allow customers to inquire about the status of orders • See records of their past purchases • Comment on services
Business-side Requirements • The business side of the Web site provides employees with the information services they need: • Orders: • Evaluate orders and • Record their status as it changes • Inventory: • Evaluate the inventory on hand • Add new movies • Update movie prices • Update the quantities as new movies arrive • Business activity: • Analyze the purchasing behavior of customers • Evaluate the popularity of movies
Evaluating the E-R Diagram • Can an employee evaluate a sale to determine how many items it includes and how much it costs? • Yes and no • Can a shipping clerk tell where to ship the items of a sale? • no • Is there any way for an employee to record information about packaging and shipping? • no • Can an employee determine inventory information such as quantity on hand of particular items? • yes • Can a manager extract information about purchasing behavior of customers? • yes • Can a manager determine the rate of sales of movies? • yes
Improving the ER Diagram • Add attribute videoType to Includes relationship types • Represent whether a shopping cart item or sale item is DVD or videotape • Add status to Sale class, and qtyShipped to Includes between Sale and Movie • Represent status of shipment • What other attributes are needed?
Using Weak Entity Classes for Many-To-Many Relationship Types • We know that many-to-many relationship types are not directly representable in relational schemas • It is appropriate to modify the ER diagram to eliminate them • Create a new weak entity class for each many-to-many relationship type
Modeling Shopping Carts and Wish Lists • Entity class ShoppingCart is used to represent the customer’s interest in buying items • Modeling almost identical to Sale • No qtyShipped, no billing information, no shipping address • Buying process is intended to be • Customer is identified to the system • Customer searches for items • Customer adds items to cart • Customer modifies cart items: delete or change quantity • Customer goes to checkout to buy items in cart • A wish list is similar to a shopping cart • Provides a way for a user to remember items for later purchase • May have longer lifetime than a shopping cart • May be shown to other users to allow gift purchases
Modeling to Support Searching for Movies • The BigHit Online Web site does not have movie searching • Click on “search” and presented with comedy movies • Searching should be based on title, genre, date • Also based on people who are involved in production • Also based on similarity and reviews (not shown)
Final Evaluation of the Conceptual Model • See Figure 13.7
Relational Model for BigHit Online • Direct translation of ER diagram to relational schema
Some SQL to Create Tables • createtable ShoppingCart ( cartId varchar(16) notnullprimarykey, startDate datetimenotnull, status varchar(16) notnull, lastUpdate datetimenutnull,foreignkey cartId to Customer(accountId)) • createtable CartItem ( cartId varchar(16) notnull, line intnotnull, movieId intnotnullreferences Movie(movieId), quantity intnotnull, videoType char(4) notnull, cost moneynotnull,foreignkey cartId references ShoppingCart(cartId),primarykey (cartId, line))
Creating a SQL Server Database • Microsoft Office Professional (with Access) includes SQL Server database • Called MSDE (Microsoft Data Engine) • Separate install from CD directory • Once installed, • Open Access database • Choose upsizing wizard • Follow directions • Viola!
Web Site Design, Pages, and Flow • Fundamental design • Navigation through buttons on header of every page • No predefined path through pages • Identify the major pages required for user interaction • Identify the SQL statements required to produce each page • Typical purchase scenario • Customer logs in • Searches for videos • Adds videos to the shopping cart • Modifies the contents of the shopping cart • Goes to checkout • Reviews purchase • Confirms purchase • What’s left out?
Login and Customer Information • Welcome page includes fields for accountId and password • Checking for login requires • Select * from Customer where accountId=lower(‘JoJo’) • JoJo is the accountId entered by customer in Figure 13.13 • Once the user has logged in, the information from the select statement is used to produce the customer information page
Shopping Carts, Searching, and Selecting Items • Create new shopping cart • insertinto ShoppingCart (cartId, startDate, status, lastUpdate) values ('jojo', getdate(),'new', getdate()) • Display items in shopping cart • select * from ShoppingCart where cartId = 'jojo' • select line, c.movieId, title, quantity, videoType, cost, quantity*cost as totalCost from cartItem c, Movie m where c.movieId=m.movieId and cartId='jojo' orderby title • Add items to shopping cart • insertinto CartItem (cartId, line, movieId, videoType, quantity,cost) values ('jojo','1','189','dvd',2,39.95) • insertinto CartItem (cartId, line, movieId, videoType, quantity,cost) values ('jojo','2',' 987','vhs', 3, 9.99) • Search for comedy movies • select * from Movie where genre like '%comedy%' orderby title
Checkout and Receipt • Create new Sale entity • select max(salesId) from Sale // returns 66, e.g. • insert into Sale (salesId,accountId,saleDate,status,totalCost) values (66,'jojo',getdate(),'sold',0) • Move items from shopping cart into SaleItem • insertinto SaleItem select 66, line, movieId, quantity, videoType, cost, 'pending' from CartItem where cartId='jojo' and quantity<>0 • Update total cost in sale • select sum(quantity*cost) from SaleItem where salesId=66 • update Sale set totalCost=112.87 where salesId=66 • Update inventory • update Movie set dvdQty=dvdQty-2 where movieId=189 • update Movie set tapeQty=tapeQty-3 where movieId=987 • Delete items from shopping cart • deletefrom cartitem where cartId='jojo' • deletefrom shoppingcart where cartId='jojo' • Produce receipt page (see p. 348)