18
COMP3241 COMP3241 E-Commerce E-Commerce Technologies Technologies Richard Henson Richard Henson University of Worcester University of Worcester November November 2012 2012

COMP3241 E-Commerce Technologies

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: COMP3241  E-Commerce Technologies

COMP3241 COMP3241 E-Commerce TechnologiesE-Commerce Technologies

Richard HensonRichard Henson

University of WorcesterUniversity of Worcester

NovemberNovember 20122012

Page 2: COMP3241  E-Commerce Technologies

Week 9: Mechanism of Shopping Week 9: Mechanism of Shopping System, Part 3System, Part 3

Objectives:Objectives: Use a pre-defined control to send data to either the Use a pre-defined control to send data to either the

shopping cart or a database, depending on the way shopping cart or a database, depending on the way parameters are usedparameters are used

Use a further control to save order data to a Use a further control to save order data to a database table for use in customer fulfillmentdatabase table for use in customer fulfillment

Provide a final link to a payment system that will Provide a final link to a payment system that will allow the order to be processed and physically sent allow the order to be processed and physically sent to the customerto the customer

Page 3: COMP3241  E-Commerce Technologies

Putting it all togetherPutting it all together

You’ve already achieved a lot:You’ve already achieved a lot:Designed and created a database Designed and created a database

containing suitable tables and fieldscontaining suitable tables and fieldsUsed webxel controls to create a “click to Used webxel controls to create a “click to

buy” system complete with shopping cartbuy” system complete with shopping cart(Perhaps…) completed a login/register (Perhaps…) completed a login/register

customer details systemscustomer details systems» if still mystified all should become clear by the end if still mystified all should become clear by the end

of this lecture…of this lecture…

Page 4: COMP3241  E-Commerce Technologies

Why all that “Validation” stuff?Why all that “Validation” stuff?

Two reasons:Two reasons:make sure the data is of the right type e.g. make sure the data is of the right type e.g.

telephone number not put in email address telephone number not put in email address text boxtext box

make sure only data of the right type gets make sure only data of the right type gets sent to the cart or databasesent to the cart or database

» could get memory overflow…could get memory overflow…» or failed Database write…or failed Database write…» (Neither would impress the customer!)(Neither would impress the customer!)

Page 5: COMP3241  E-Commerce Technologies

What sort of Button What sort of Button should be usedshould be used??

Data being presented on a HTML form… Data being presented on a HTML form… <form><form>

It should therefore be extracted with a It should therefore be extracted with a HTML HTML submitsubmit button near the bottom of the form… button near the bottom of the form… before </form>before </form> will send the data to a location specified on the will send the data to a location specified on the

form “header” (e.g. runat=“server”)form “header” (e.g. runat=“server”) not to be confused with buttons used to run a not to be confused with buttons used to run a

small chunk of codesmall chunk of code

Page 6: COMP3241  E-Commerce Technologies

What happened to the What happened to the customer data anyway? customer data anyway?

Once you completed the last exercise, you Once you completed the last exercise, you might have expected new order data to be might have expected new order data to be written to the database…written to the database… but nothing appeared in “orders”but nothing appeared in “orders”

All the data for the order now resides in the All the data for the order now resides in the cart: cart: orderID orderID customerIDcustomerID the various aspects of the order needed for the the various aspects of the order needed for the

onscreen invoiceonscreen invoice

Page 7: COMP3241  E-Commerce Technologies

And the rest of the Data?And the rest of the Data? What actually happened was that the What actually happened was that the

order data was written to the cart under order data was written to the cart under the label “orderID”the label “orderID”

And the customer details were written to And the customer details were written to the customers tablethe customers tableit was not programmed to write order data it was not programmed to write order data

yetyet» this won’t happen until they have acknowledge the this won’t happen until they have acknowledge the

onscreen order (i.e. they agree to pay…)onscreen order (i.e. they agree to pay…)

Page 8: COMP3241  E-Commerce Technologies

Why “Save to Cart”?Why “Save to Cart”?

Data quickly saved locallyData quickly saved locallyand easily accessible when it needs to be and easily accessible when it needs to be

extractedextracted» e.g. address fields for screen invoicee.g. address fields for screen invoice

If screen invoice not accepted, and If screen invoice not accepted, and “customer” leaves“customer” leaves

» ““customer” data easily removed…customer” data easily removed…» also good for “data protection” – personal data only also good for “data protection” – personal data only

ever saved to memoryever saved to memory

Page 9: COMP3241  E-Commerce Technologies

Passing the CustomerID Passing the CustomerID ParameterParameter

Customer Page

WriteToDB scripts

Customer ID value sent as e.g. “CustomerID”

fields sent To shopping cart

Shopping Cart

custdata

Page 10: COMP3241  E-Commerce Technologies

Saving and Displaying Saving and Displaying the Orderthe Order

On screen Invoice is displayed On screen Invoice is displayed Action only happens when user Action only happens when user

clicks on “Pay Now”…clicks on “Pay Now”…Orderdata written Orderdata written again uses the WriteToDB controlagain uses the WriteToDB controlwrites “OrderLine” Cart fields to writes “OrderLine” Cart fields to

datatabledatatable

Page 11: COMP3241  E-Commerce Technologies

Writing the Order Details to Writing the Order Details to Screen (and Database)Screen (and Database)

Write to DB control

Product ID value Shopping Cart

Remote DB

Contains all data needed to write orderline to disk (with primary key OrderLineID)

Customer ID value

Screen display

Order details

Page 12: COMP3241  E-Commerce Technologies

More about that multivalue More about that multivalue WebXel control property:WebXel control property:

Called “field mappings”Called “field mappings” You’ve used these a couple of times now:You’ve used these a couple of times now:

AddFromDB… populating CartFields from the AddFromDB… populating CartFields from the Products tableProducts table

WriteToDB… populating CartFields from the WriteToDB… populating CartFields from the customer details formcustomer details form

Either tagged as “Parameters” or “Fields”Either tagged as “Parameters” or “Fields”

Page 13: COMP3241  E-Commerce Technologies

Using “Field Mappings” with Using “Field Mappings” with Visual StudioVisual Studio

This feature was intended to take the hard work This feature was intended to take the hard work out of parameter passing…out of parameter passing… unfortunately not compatible with Visual Studio unfortunately not compatible with Visual Studio

“design mode”… “design mode”… so errors generated!so errors generated! and “properties” can’t be used the insert values (as and “properties” can’t be used the insert values (as

they could with “Cart”)they could with “Cart”) fields could be added as “cartfields” or fields could be added as “cartfields” or

“databasefields”“databasefields” need to refer to the WebXel control “help” for exact need to refer to the WebXel control “help” for exact

syntax of controls with “field mappings”syntax of controls with “field mappings”

Page 14: COMP3241  E-Commerce Technologies

Explaining Parameter Passing Explaining Parameter Passing for a new customerfor a new customer

Customer puts their data into textbox controlCustomer puts their data into textbox control Customer presses “submit” button to allow Customer presses “submit” button to allow

the WriteToDB control to runthe WriteToDB control to run Data captured and sent to cart and Database Data captured and sent to cart and Database

with appropriate fieldnameswith appropriate fieldnames CustomerID field essential for both Cart and CustomerID field essential for both Cart and

Customers datatableCustomers datatable

Page 15: COMP3241  E-Commerce Technologies

Converting between Converting between DataTypesDataTypes

Sometimes necessary Sometimes necessary when passing when passing parameters to change parameters to change the datatypethe datatype known in “C” programming known in “C” programming

as “casting”as “casting” Easy to achieve a cast…Easy to achieve a cast…

e.g. number to a string e.g. number to a string would just add .tostring() would just add .tostring() after the expression after the expression

can be used to change can be used to change data to currency formatdata to currency format

Variable(integer)

Variable(string)

Expression plus .tostring()

Page 16: COMP3241  E-Commerce Technologies

Saving The Order itselfSaving The Order itself

Handled by the WebXelCart:SaveOrder Handled by the WebXelCart:SaveOrder controlcontrolworks in a similar way to WritetoDBworks in a similar way to WritetoDBbut writes appropriate cart fields to the but writes appropriate cart fields to the

ORDERS tableORDERS table Important differences between Important differences between

WritetoDB and SaveOrder in this coding:WritetoDB and SaveOrder in this coding:but both can write cart fields to databasebut both can write cart fields to database

Page 17: COMP3241  E-Commerce Technologies

PaymentPayment Next section presented after invoice has Next section presented after invoice has

been acknowledged…been acknowledged…would normally transfer through secure would normally transfer through secure

connection to a merchant services provider connection to a merchant services provider pagepage

once payment has been authorised and once payment has been authorised and taken…taken…

» customer returns to “come again soon” page then customer returns to “come again soon” page then exits the websiteexits the website

» session cookie (i.e. cart) erasedsession cookie (i.e. cart) erased

Page 18: COMP3241  E-Commerce Technologies

That’s all… for this weekThat’s all… for this week