<%@ Language=VBScript %> <% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : Options Groups Maintenance ' Product : CandyPress Store Administration ' Version : 2.5 ' Modified : February 2004 ' Copyright: Copyright (C) 2004 CandyPress.Com ' See "license.txt" for this product for details regarding ' licensing, usage, disclaimers, distribution and general ' copyright requirements. If you don't have a copy of this ' file, you may request one at webmaster@candypress.com '************************************************************************* Option explicit Response.Buffer = true const adminLevel = 1 %> <% 'Database dim mySQL, cn, rs 'OptionsGroups dim idOptionGroup dim optionGroupDesc dim optionReq dim optionType dim sortOrder dim optionLength 'Work Fields dim action '************************************************************************* 'Open Database Connection call openDB() 'Store Configuration if loadConfig() = false then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Could not load Store Configuration settings.") end if %>

Option Group Maintenance

<% 'Page Tabs call optTabs("OG") 'Get action action = trim(Request.QueryString("action")) if len(action) = 0 then action = trim(Request.Form("action")) end if action = lCase(action) if action <> "edit" _ and action <> "del" _ and action <> "add" then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Action Indicator.") end if 'Get idOptionGroup if action = "edit" or action = "del" then idOptionGroup = trim(Request.QueryString("recId")) if len(idOptionGroup) = 0 then idOptionGroup = trim(Request.Form("recId")) end if if idOptionGroup = "" or not isNumeric(idOptionGroup) then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Record ID.") end if end if 'Get Record if action = "edit" or action = "del" then mySQL="SELECT idOptionGroup,optionGroupDesc,optionReq," _ & " optionType,sortOrder,optionLength " _ & "FROM OptionsGroups " _ & "WHERE idOptionGroup = " & idOptionGroup set rs = openRSexecute(mySQL) if rs.eof then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Record ID.") else OptionGroupDesc = trim(rs("OptionGroupDesc")) OptionReq = trim(rs("OptionReq")) OptionType = trim(rs("OptionType")) sortOrder = trim(rs("sortOrder")) optionLength = trim(rs("optionLength")) end if call closeRS(rs) end if 'Edit if action = "edit" then if len(trim(Request.QueryString("msg"))) > 0 then %> <%=Request.QueryString("msg")%>

<% end if %> Edit Option Group  <%call maintNavLinks()%>

<% 'Show common fields call commonFields() %>
Options
<% 'Show options linked to option group mySQL="SELECT a.idOptOptGroup, b.idOption, b.optionDescrip," _ & " b.priceToAdd, b.percToAdd " _ & "FROM optionsXref a " _ & "INNER JOIN options b " _ & "ON a.idoption = b.idoption " _ & "WHERE a.idOptionGroup = " & idOptionGroup & " " _ & "ORDER BY b.sortOrder, b.optionDescrip " set rs = openRSexecute(mySQL) do while not rs.eof %> <% rs.movenext loop call closeRS(rs) %>
<%=rs("optionDescrip")%>
Price: <%=pCurrencySign & moneyD(rs("priceToAdd"))%>   Perc: <%=formatNumber(rs("percToAdd"),2)%>%
&idOptionGroup=<%=idOptionGroup%>&recId=<%=rs("idOptOptGroup")%>">Remove
Exclude this Option from Products after Add?
<% end if 'Add if action = "add" then %> Add Option Group  <%call maintNavLinks()%>

<% 'Show common fields call commonFields() %>
<% end if 'Delete if action = "del" then %> Delete Option Group  <%call maintNavLinks()%>

Group Description Type Required?
<%=optionGroupDesc%> <%=optionType%> <%=optionReq%>
<% end if if action = "edit" or action = "add" then %>
Help and Instructions :
Option Group Description - Mandatory. A name for the option group.

Type - Mandatory. Drop-down Lists and Radio Buttons can be used to allow the customer to select one option from a list of options. Text Input options will display a text box into which the customer must enter some text that goes with the option (eg. an inscription on a bracelet, etc.). This type of option group is limited to one option per group.

Maximum Length - Mandatory. Valid values are 2 - 200. This field will determine the maximum length of a "Text Input" type option. For other option types, this value will be ignored.

Required? - Mandatory. If set to 'Yes', the customer will have to select one of the options in the option group. If it's a Text Input option type, the customer will have to enter text into the text box. If set to 'No', the options for this option group will be optional.

Sort Order - Optional. Numeric value that can be used to order the Option Group when a product is displayed. If no value is supplied, the option groups will be sorted by their descriptions.

<% if action = "edit" then %> Options - This is a list of options currently linked to this option group. You can add more options to the option group, or remove them from the option group.

Note : By default, when an option is added to an option group, all products linked to that option group will automatically include that option as well. By checking the box provided, you can change the default to where the added option will be excluded from all products linked to the option group. Using the product maintenace function, you can then include or exclude options from individual products as required.

<% end if %>
<% end if call closedb() %> <% '********************************************************************* 'Display common form fields '********************************************************************* sub commonFields() 'set some defaults if isNull(optionLength) or isEmpty(optionLength) or not isNumeric(optionLength) then optionLength = 100 end if %>
Group Description Type Maximum Length    Used with "Text Input" types. Required? Sort Order <% if action = "edit" then %>

<% else %> <% end if %>
<% end sub '********************************************************************* 'Create Navigation Links '********************************************************************* sub maintNavLinks() %> [ List Groups | >Edit | Add | >Delete ] <% end sub %>