%
'*************************************************************************
' ASP Scripting:
' Filename: handler_shopping_cart.asp
' Written by: Wilbert Madarang
' Date: May 7, 2003
'*************************************************************************
' Description: Handles the Shopping Cart
'*************************************************************************
' Revision History:
'*************************************************************************
%>
<%
'************************************
' Global Variable Declaration
'************************************
Dim strProductId, strProductCode, strProductName, strProductRegularPrice, strProductSalePrice, strQuantity, strAction, strColor
Dim nProductRegularPrice, nProductSalePrice, nQuantity
'************************************
' Main Schema
'************************************
Call ParseParameters()
Call PrintParameters()
'************************************
' Main Handler
'************************************
SELECT CASE strAction
Case "add"
Response.Write "Adding to Cart.
" & vbCrLf
Call SCart_Add_Item( strProductId, strProductCode, strProductName, strProductRegularPrice, strProductSalePrice, strQuantity, strColor )
Case "delete"
Call SCart_Del_Item( strProductId )
' Case "modify"
' 'Response.Write "modify
" & vbCrLf
' Case "modify_quantity"
' Case "view"
' Case Else
End Select
'Call SCart_View_Cart
Response.Redirect Request.ServerVariables("HTTP_REFERER")
'*************************************************************************
' Function: ParseParameters
' Description: parse parameters
' Parameters: none
' Returns: none
' Written by: Wilbert Madarang
' Date: May 7, 2003
'*************************************************************************
' Side-Effects: Fills in Global Variables
'*************************************************************************
Function ParseParameters
strProductId = Request( "product_id" )
strProductCode = Request( "product_code" )
strProductName = Request( "product_name" )
'strProductPrice = Request( "product_price" )
strProductRegularPrice = Request( "regular_price" )
strProductSalePrice = Request( "sale_price" )
strColor = Request( "color" )
strQuantity = Request( "quantity" )
strAction = Request( "action" )
nProductRegularPrice = CCur( strProductRegularPrice )
nProductSalePrice = CCur( strProductSalePrice )
nQuantity = CInt( strQuantity )
End Function
'*************************************************************************
' Function: PrintParameters
' Description: print parameters
' Parameters: none
' Returns: none
' Written by: Wilbert Madarang
' Date: May 7, 2003
'*************************************************************************
Function PrintParameters
Response.Write "ProductId is " & strProductId & "
" & vbCrLf
Response.Write "ProductCode is " & strProductCode & "
" & vbCrLf
Response.Write "ProductName is " & strProductName & "
" & vbCrLf
'Response.Write "ProductPrice is " & strProductPrice & "
" & vbCrLf
Response.Write "ProductRegularPrice is " & nProductRegularPrice & "
" & vbCrLf
Response.Write "ProductSalePrice is " & nProductSalePrice & "
" & vbCrLf
Response.Write "Color is " & strColor & "
" & vbCrLf
Response.Write "Quantity is " & nQuantity & "
" & vbCrLf
Response.Write "Action is " & strAction & "
" & vbCrLf
End Function
%>