%@ LANGUAGE="VBSCRIPT" %>
<%
'********************* Note to developer ***************
'The output of this page will be in JavaScript format.
'To override this and to generate direct HTML output,
'type the URL into your browser's address box
'and APPEND it with the query string
' debug=true
'This allows you to examine its run-time contents.
'*******************************************************
'!!!WARNING!!!
'DO NOT EDIT THIS PAGE UNDER FRONTPAGE EDITOR.
'USE NOTEPAD INSTEAD
'HOW TO USE:
'INSERT the following code to your HTML pages:
'
'WHERE myproduct is the Reference Code for the product item.
'QUALIFY the "view_product.asp" with appropriate domain and path.
'SPECIAL CASES
'Search Box
'
'View Cart button
'
'Set to False to allow wildcard match at the end of the product id
Session(DSN+"ExactMatch") = False
'If false, specify the field by which the result will be ordered.
Session(DSN+"OrderBy") = "ProductDesc"
'Page Messages: Feel free to redefine them
Session(DSN+"view_product"+"M1") = "Enter keywords to search."
Session(DSN+"view_product"+"M2") = "Search"
Session(DSN+"view_product"+"M3") = "Click to Find the match(s)."
'Page Settings:
Const VIEWCART_IMG = "viewcart.gif"
Const ADDITEM_IMG = "additem.gif"
Const TEXT_FONT = ""
Const IMAGE_DIR = ""
Const POPUP = "yes" 'possible values "no" or "hide"
%>
<%Call CreateMyObject %>
<%
If IsObject(MyObject) Then
MyObject.VIEWCART_IMG = VIEWCART_IMG
MyObject.ADDITEM_IMG = ADDITEM_IMG
MyObject.TEXT_FONT = TEXT_FONT
MyObject.IMAGE_DIR = IMAGE_DIR
End If
%>
<%
Dim bGSTAdded, sGSTAdded
'This is typically for Australian businesses only.
'It queries the shopping cart to see if a GST inclusive price should be displayed.
Function AddGSTToPrice(ByRef curPrice, ByRef rsCatalog, ByRef sGSTAdded)
Dim rs, SQL, sStr
AddGSTToPrice = False
sGSTAdded = ""
If IsNull(Session(DSN+"AddGSTToPrice")) Or Len(Session(DSN+"AddGSTToPrice")) = 0 Then
Session(DSN+"AddGSTToPrice") = 0
SQL = "SELECT TaxRate FROM Admin WHERE StateProv = '-GST-' AND Country Is NOT NULL And TaxRate > 0"
Call OpenRecordset(rs, SQL, connDSN, 3, 1)
If Not rs.EOF Then
Session(DSN+"AddGSTToPrice") = CDbl(rs.Fields("TaxRate").Value)
End If
rs.Close
Set rs = Nothing
End If
If Session(DSN+"AddGSTToPrice") > 0 Then
If IsNull(curPrice) Then
Exit Function
ElseIf Not IsNumeric(curPrice) Then
Exit Function
ElseIf Not IsObject(rsCatalog) Then
'Reley on previous call to determine if GST should be applied
If bGSTAdded Then
curPrice = CDbl(curPrice) * (1 + Session(DSN+"AddGSTToPrice"))
End If
Exit Function
ElseIf Not IsNull(rsCatalog.Fields("Taxable").Value) Then
sStr = LCase(CStr(rsCatalog.Fields("Taxable").Value))
If sStr = "no" Or sStr = "false" Or sStr = "0" Then
sGSTAdded = " (No GST) "
Exit Function
End If
End If
curPrice = CDbl(curPrice) * (1 + Session(DSN+"AddGSTToPrice"))
sGSTAdded = " (incl GST) "
AddGSTToPrice = True
End If
End Function
%>
<%
Call ProcessPage
Function FormatSubmitTag(sImage, sWidth, sHeight, sBorder)
If IsObject(MyObject) Then
FormatSubmitTag = MyObject.FormatSubmitTag(sImage, sWidth, sHeight, sBorder)
End If
End Function
Function FormatImageTag(sImage, sWidth, sHeight, sBorder)
If IsObject(MyObject) Then
FormatImageTag = MyObject.FormatImageTag(sImage, sWidth, sHeight, sBorder)
End If
End Function
Sub OutputToPage(ByRef sOutput)
If IsObject(MyObject) Then
Call MyObject.OutputToPage(sOutput)
End If
End Sub
Sub GetStockRs(ByRef rs, ByRef sOutput, sFormStart, sFormEnd)
If IsObject(MyObject) Then
Call MyObject.GetStockRs(rs, sOutput, sFormStart, sFormEnd)
End If
End Sub
Function IsField(ByRef rs, sField)
If IsObject(MyObject) Then
IsField = MyObject.IsField1(rs, sField)
End If
End Function
Function EncryptParam(sProductID, sParam)
Dim objCyberShop
Set objCyberShop = CreateObject("CyberShop.view_cart")
If IsObject(objCyberShop) Then
On Error Resume Next
EncryptParam = objCyberShop.EncryptParam(sProductID, sParam, Session(DSN+"EncryptPassword"))
If Err.Number <> 0 Then
Err.Clear
EncryptParam = sParam
End If
End If
Set objCyberShop = Nothing
End Function
%>
<%
Sub ProcessPage()
'Page Variable
Dim rs, sOutput, sFormStart, sFormEnd
sOutput = ""
Call GetStockRs(rs, sOutput, sFormStart, sFormEnd)
If sOutput = "" And Len(Session(DSN+"ProductID")) <> 0 Then
If POPUP <> "no" Then
sFormStart = Replace(sFormStart, "