1 / 18

COMP3241 E-Commerce Technologies

COMP3241 E-Commerce Technologies. Richard Henson University of Worcester November 2012. Week 9: Mechanism of Shopping System, Part 3. Objectives: Use a pre-defined control to send data to either the shopping cart or a database, depending on the way parameters are used

Télécharger la présentation

COMP3241 E-Commerce Technologies

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMP3241 E-Commerce Technologies Richard Henson University of Worcester November2012

  2. Week 9: Mechanism of Shopping System, Part 3 • Objectives: • Use a pre-defined control to send data to either the shopping cart or a database, depending on the way parameters are used • Use a further control to save order data to a database table for use in customer fulfillment • Provide a final link to a payment system that will allow the order to be processed and physically sent to the customer

  3. Putting it all together • You’ve already achieved a lot: • Designed and created a database containing suitable tables and fields • Used webxel controls to create a “click to buy” system complete with shopping cart • (Perhaps…) completed a login/register customer details systems • if still mystified all should become clear by the end of this lecture…

  4. Why all that “Validation” stuff? • Two reasons: • make sure the data is of the right type e.g. telephone number not put in email address text box • make sure only data of the right type gets sent to the cart or database • could get memory overflow… • or failed Database write… • (Neither would impress the customer!)

  5. What sort of Button should be used? • Data being presented on a HTML form… <form> • It should therefore be extracted with a HTML submit button near the bottom of the form… before </form> • will send the data to a location specified on the form “header” (e.g. runat=“server”) • not to be confused with buttons used to run a small chunk of code

  6. What happened to the customer data anyway? • Once you completed the last exercise, you might have expected new order data to be written to the database… • but nothing appeared in “orders” • All the data for the order now resides in the cart: • orderID • customerID • the various aspects of the order needed for the onscreen invoice

  7. And the rest of the Data? • What actually happened was that the order data was written to the cart under the label “orderID” • And the customer details were written to the customers table • it was not programmed to write order data yet • this won’t happen until they have acknowledge the onscreen order (i.e. they agree to pay…)

  8. Why “Save to Cart”? • Data quickly saved locally • and easily accessible when it needs to be extracted • e.g. address fields for screen invoice • If screen invoice not accepted, and “customer” leaves • “customer” data easily removed… • also good for “data protection” – personal data only ever saved to memory

  9. Passing the CustomerID Parameter Customer Page Customer ID value sent as e.g. “CustomerID” cust data WriteToDB scripts Shopping Cart fields sent To shopping cart

  10. Saving and Displaying the Order • On screen Invoice is displayed • Action only happens when user clicks on “Pay Now”… • Orderdata written • again uses the WriteToDB control • writes “OrderLine” Cart fields to datatable

  11. Writing the Order Details to Screen (and Database) Shopping Cart Product ID value Customer ID value Contains all data needed to write orderline to disk (with primary key OrderLineID) Remote DB Screen display Write to DB control Order details

  12. More about that multivalue WebXel control property: • Called “field mappings” • You’ve used these a couple of times now: • AddFromDB… populating CartFields from the Products table • WriteToDB… populating CartFields from the customer details form • Either tagged as “Parameters” or “Fields”

  13. Using “Field Mappings” with Visual Studio • This feature was intended to take the hard work out of parameter passing… • unfortunately not compatible with Visual Studio “design mode”… • so errors generated! • and “properties” can’t be used the insert values (as they could with “Cart”) • fields could be added as “cartfields” or “databasefields” • need to refer to the WebXel control “help” for exact syntax of controls with “field mappings”

  14. Explaining Parameter Passing for a new customer • Customer puts their data into textbox control • Customer presses “submit” button to allow the WriteToDB control to run • Data captured and sent to cart and Database with appropriate fieldnames • CustomerID field essential for both Cart and Customers datatable

  15. Converting between DataTypes • Sometimes necessary when passing parameters to change the datatype • known in “C” programming as “casting” • Easy to achieve a cast… • e.g. number to a string would just add .tostring() after the expression • can be used to change data to currency format Variable (integer) Expression plus .tostring() Variable (string)

  16. Saving The Order itself • Handled by the WebXelCart:SaveOrder control • works in a similar way to WritetoDB • but writes appropriate cart fields to the ORDERS table • Important differences between WritetoDB and SaveOrder in this coding: • but both can write cart fields to database

  17. Payment • Next section presented after invoice has been acknowledged… • would normally transfer through secure connection to a merchant services provider page • once payment has been authorised and taken… • customer returns to “come again soon” page then exits the website • session cookie (i.e. cart) erased

  18. That’s all… for this week

More Related