Link back to course Welcome...
Last updated: 1/1/04

CIS_Logo.gif (390 bytes)

Agenda for Class 14 on December 9
(eCommerce only)

This agenda and class are for eCommerce only.

  1. Announcements
    1. Student Evaluation of Teaching (SET) tonight.
    2. Reminder of what you should be doing online on a regular basis -- these are part of the grade
    3. Signin, from the lab, only on days for the class(es) you are taking
    4. Weekly course report (if you are taking both classes, a single report will do)
    5. Conference postings (one per week for eCommerce, two per week for Computers, the Internet, and Society, three per week if you are taking both). In order to count towards the requirement, postings should be (a) minimum of five lines and (b) about the course topic(s) and class. What to post about? Here are some possibilities
    6. Not required, but do it anyway - check your email on at least a weekly basis. Don't have email: use hotmail - it's easy and free. See me if you need help.
  2. Last assignments - reminder (see syllabus and assignment schedule for details)
    1. Final Report. Here is what should be in your Final Report for this course:
      1. Description. A brief description of your eCommerce company or organization; It's name and what it does.
      2. Web Site Map. A final version of the layout of your web site, similar to the one you did before, showing each page as a block with the file name beside it, and showing the links as arrows linking the blocks. Hand drawn is OK.
      3. Order-taking Narrative. A Narrative describing how the order-taking part of your web site works, starting, for example, with "The user fills out the order form and clicks SUBMIT." The description of what happens in the ASP page should be fairly detailed, describing how calculations are done for example, where the fields in the database come from, and how the email message is constructed. (We can go over this in class if you have trouble with this part, but I do want you to show that you understand how your ASP page works.)
      4. Any use you made of the Seybold text, or any place where her issues come up in your web site.
      5. A review of each of the other three eCommerce web sites, describing
        1. what the web site did, and how easy or hard it was for you to find this out
        2. how easy or hard it was for you to find at least one piece of information, the same for all three sites, such as Return Policy, Privacy Policy, and so forth
        3. your experience in placing an order (please bear in mind that these order forms should be filled out completely).
      6. A print-out of your eCommerce database.
  3. A look at the order processor - ProcessOrder.txt. Actual ASP code from this file shown in Courier Bold, other text is explanations.
    1. Almost all problems had to do with variable names not matching - form to ASP to database
      1. Section that calculates totals and subtotals from form data. Everyone had to modify this section, some more than others. At least, the code has to be modified to match the names on the form and in the database.
        Dim SubTotal1
        Dim SubTotal2
        Dim SubTotal3
        Dim N1, N2, N3, C1, C2, C3
        Dim TotalCost
        These "DIM" statements set aside storage locations with the variable names (e.g. SubTotal1)
        N1 = Request("Number_1")
        N2 = Request("Number_2")
        N3 = Request("Number_3")
        These "N" statements get the information for how many items of each type are being ordered, from the form. "Request" gets the information from the form, for the variable named inside the parentheses. The = sign stores that value in N1, N2 or N3. If there is, for example, no "Number_1" field on the form, Request becomes nothing (Null string or no characters at all). In this case, when N1 is used as a number, its numerical value is zero. Therefore the names inside the parentheses must match the names of form fields, exactly.
        C1 = Request("Cost_1")
        C2 = Request("Cost_2")
        C3 = Request("Cost_3")
        These "C" statements similarly get the cost for each item from the form data. In this example, the costs are in hidden fields on the form, named Cost_1, etc.
        SubTotal1 = N1 * C1
        SubTotal2 = N2 * C2
        SubTotal3 = N3 * C3
        These SubTotal statements calculate the cost subtotals for each items as the number ordered times the unit costs.
        TotalCost = SubTotal1 + SubTotal2 + SubTotal3
        The above statement calculates the total cost as the sum of the three subtotals.
      2. For each fld in rsOrder.Fields - rsOrder is a recordset (that is the meaning of the "rs" in "rsOrder"), which is one or more records from the database, existing in RAM. rsOrder.Fields is the collection of all of the database fields. "For each fld" means that fld becomes each field in turn, one after the other, with no guaranteed order (a collection does not have a guaranteed order, while a list does). The statements between "For each" and "Next" are executed for each fld. At "Next", the program jumps back to "For each", and fld becomes the next field.
        NOTE: The database itself is the .mdb file existing on the disk drive (in this case, the file on the web server). The loop between "For each" and "Next" works on the recordset, not the database. The recordset is copied to the file later on in the ASP file, in the rsOrder.Update statement.
      3. FieldName = fld.Name - this statement saves the name of the field fld in the variable FieldName.
      4. The If Then / Elseif Then / Else / End If sequence is called a "flow control" structure. Each of the Ifs is tried, the first one first, and if that is true then the corresponding Then is executed, and then control jumps to the End If. If the first If is not true, then the second one is tried, then the third, and so forth. If none of the Ifs or ElseIfs is satisfied, then control goes to the Else. In this case, the Ifs and ElseIfs are fields in the recordset that do not get their values from the form input, but from the system clock, from the calculations of the SubTotals, or from other sources. The Else covers all fields from the HTML form - they are just copied over.
      5. FieldValue = Request(FieldName) - Request("Name") is the value from the form. In order for this to work, the database fields and the form fields must have exactly the same names. If there is a name mismatch (a database field name for which there is no form field name) then Request yields a "null string" - no characters.
      6. Next. At this point, the program jumps back up to the "For each" statement and fld becomes the next field in the database. After the last database field, the program takes the statement following "Next".
      7. rsOrder.Update - this copies the recordset rsOrder into the database file. At this point, the database generates the next order number automatically, and this Update statement also updates the recordset rsOrder to now include the order number.
      8. Constructing the response page:
        <%
        For each fld in rsOrder.Fields
        FieldName = fld.Name
        FieldValue = rsOrder.Fields(FieldName)
        %>
        <tr>
        <td width="20%"><b><%=FieldName%></b></td>
        <td width="80%"><%=FieldValue%></td>
        </tr>
        <% Next %>
         
        *****
        This sequence cycles over the fields in rsOrder a second time. The <tr> tag starts a new row in the table (one row for each field). The <td ...> tags start a cell in that row. <%=FieldName%> and <%=FieldValue%> put the name and value of the field in the left and right cells, respectively. The "For Each" cycles through each field, and the code from there down to Next is repeated for each field, even though some of the code is straight HTML (the <tr> and <td ...>s), not ASP. The response page will therefore be a table, one row per database field, with the field name in the left column and the order information in the right column.
      9. Constructing the email message
        strMessage = ""  - Sets the email message strMessage to a null or empty string.
        For each fld in rsOrder.Fields  - cycles over the fields again.
        FieldName = fld.Name
        FieldValue = rsOrder.Fields(FieldName)
        strMessage = strMessage & FieldName & ": " & FieldValue &
                     vbNewLine

        Next
        The line with strMessage = strMessage & ... adds the ... to the email message, one line at a time. "&" means to concatenate strings, or tack the second one on to the end of the first one, making a single string. vbNewLine starts a new line in the message. If this were HTML, we would use <br> instead, but not all email is HTML. vbNewLine makes a new line in whatever coding system is used.
    2. Making the printout look better
      1. Many of you wanted a more attractive and transparent confirmation page. Particularly you were objecting to the appearance of field names that were compound words, such as OrderNumber or Order_Number. Customers are generally able to cope with this quite well, but to really make normal, define a new variable, the value that will be printed for the user, say "PrintName" instead of "FieldName." There are two easy techniques:
        1. Make the field names using the underscore, for example Order_Number, and then replace the underscore in FieldName with a space, to make PrintName. The code for this is relatively easy, and needs only be written once, and works for any compound field name.
        2. Use an If / ElseIf / Else / End If structure to make a completely customized print name for each field name. This involves a lot more coding, but can do anything you want.
      2. The same techniques can be used with the email message to improve its appearance.
      3. Hardest and first part is to get the function right, then make it look better afterwards.
    3. Other programming languages that can do this type of work:
      1. ColdFusion (interpreted - .cfm)
      2. PHP (interpreted - .php)
      3. Perl (interpreted - .pl)
      4. Java (interpreted - .java, .class) Java can work similarly to ASP - Java contains JSP, Java Server Pages, for example. Java works both client-side and server-side.
      5. C, C++ (compiles to an executable file - .exe - )
      6. Visual Basic, Visual Basic for Applications (compiles to an executable file - .exe)
  4. Why use eCommerce?
    1. Low cost
    2. Quick
    3. At least some customers prefer it - not having to deal with traffic, parking and retail clerks
    4. Customers do your data entry for you, and thank you for it. They are probably more careful than your data entry clerks.
    5. Generally, web sales are growing at something like 20% per year while retail sales are more or less flat.
    6. What is succeeding is retail stores with web sites. Often, customers will research a product online, and come to the store to see and buy it.
    7. Faster process - see news story about this
    8. More advantageous financial terms compared to bricks-and-mortar stores - receive payment when credit card is charged at the time of shipping, pay on supplier's billing cycle 30 days later. Bricks-and-mortar- pay 30 days after received for stock, get paid later when merchandise sells.
    9. Online sales are popular because at this point they are not subject to federal taxes
    10. Getting to watch your customers read your catalog
    11. Up-to-date database of what is selling, individual customer tastes and preferences, etc.
  5. What we didn't cover
    1. Multipart forms. The problem is that the web does not remember you from one hit to the next. Cannot put the two form parts together. Solutions:
      1. Hidden fields - put in the order number or other ID in a hidden field in the later parts of the forms, then can match those to the first section.
      2. Cookies. A cookie is a small file (Netscape) or a field in a cookie file (Internet Explorer) set on the user's computer under control of the web site. The cookie can contain the web site URL and an order number or other ID.
    2. Security
      1. Public key / private key encryption. Merchant sends public key with order form, used to encrypt order on way to Internet. Merchant uses private key to decrypt order info. Very resistant to tampering. Also guarantees to customer that this really is Amazon's web site. Guarantee comes from a Certificate Authority. Protocol is not http but https or shttp (less common). Also see security icon:
        or
      2. Real problem is with databases on merchant's server or database server. Usually not hacked, but taken with collusion from an authorized employee.
      3. Effect of Internet is to make high volume possible, both bulk theft and bulk reselling.
    3. Processing orders. Can be done without Internet, using normal data entry techniques, working on the same database. Each one of these steps can also generate an automatic email, so in the normal course of doing their job, employees also notify customers of the change in status.
      1. Order status
      2. Shipping
      3. Charging the credit card.
      4. Track Shipment. Let the customer look at the database to see the order status. (For shipping status, send the customer to the shipper's web site to look at that database.) Here, the customer would have to enter an order number and some ID. The tracking ASP file would then get that record from the database, confirm the ID, and then make a response page showing current status and as much of the order information as you desired.
      5. The centralized database approach also puts all order information at the hands of customer service staff so that they can solve customer problems over the phone. In "the old days" we used to get shuffled from department to department, because each department kept its own paper records, but these days we expect better treatment, and we can get it using the centralized database approach. It may also mean that customer service doesn't need specialized training and so can be paid less.
  6. Other uses
    1. Non-profit, e.g. volunteering, donating
    2. Politics
    3. Conferencing, chatting, blogging, journals, etc (can be done without this, but generally use forms and interactivity)