<%@ Language=VBScript %> <% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : Options 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 'Options dim idOption dim optionDescrip dim priceToAdd dim weightToAdd dim taxExempt dim percToAdd dim sortOrder '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 Maintenance

<% 'Page Tabs call optTabs("OP") '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 idOption if action = "edit" _ or action = "del" then idOption = trim(Request.QueryString("recId")) if len(idOption) = 0 then idOption = trim(Request.Form("recId")) end if if idOption = "" or not isNumeric(idOption) then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Option ID.") end if end if 'Get Option Record if action = "edit" or action = "del" then mySQL="SELECT optionDescrip,priceToAdd,weightToAdd," _ & " taxExempt,percToAdd,sortOrder " _ & "FROM options " _ & "WHERE idOption = " & idOption set rs = openRSexecute(mySQL) if rs.eof then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Option ID.") else optionDescrip = rs("optionDescrip") priceToAdd = rs("priceToAdd") weightToAdd = rs("weightToAdd") taxExempt = rs("taxExempt") percToAdd = rs("percToAdd") sortOrder = rs("sortOrder") 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  <%call maintNavLinks()%>

<% 'Show common fields call commonFields() %>
Option Groups
<% 'Get Option Groups for this Option mySQL="SELECT b.idOptionGroup, b.optionGroupDesc " _ & "FROM optionsXref a " _ & "INNER JOIN optionsGroups b " _ & "ON a.idOptionGroup = b.idOptionGroup " _ & "WHERE a.idOption = " & idOption set rs = openRSexecute(mySQL) do while not rs.eof %> <% rs.movenext loop call closeRS(rs) %>
<%=rs("optionGroupDesc")%> ">Edit
<% end if 'Add if action = "add" then %> Add Option  <%call maintNavLinks()%>

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

Option Description Price Perc. Weight
<%=optionDescrip%> <%=moneyD(priceToAdd)%> <%=formatNumber(percToAdd,2)%> <%=weightToAdd%>
<% end if if action = "edit" or action = "add" then %>
Help and Instructions :
Option Description - Mandatory. A name for the option.

Price - Optional. You can specify a fixed Price for an option.

Percentage - Optional. You can specify that the option Price be calculated as a percentage of the Product Price. If both a fixed price and percentage is entered, the system will use the higher amount. This way you can ensure a "minimum" option price.

Weight - Optional. If entered, the weight will be factored into the shipping cost calculation, along with the product's weight. Note that, if a product with 'Free Shipping' set to 'Yes' (see product maintenance) is added to the shopping cart, all related options added to the shopping cart will also be considered free of shipping (ie. weight will be ignored). You must use the same Unit of Weight (Kilogram, Grams, Pounds, etc.) for the option, product and shipping rate weights (see Product & Shipping Maintenance). So, if you enter the weight in "pounds" here, you must also enter the weight in "pounds" for products and shipping rates.

Tax Exempt - Mandatory. The Tax Exempt indicator is used when calculating taxes. If set to "Yes", no taxes will be calculated on the price of the option. If set to "No", the option's price will be added into the tax calculation.

Sort Order - Optional. Numeric value that can be used to order the Options within an Option Group. If no value is supplied, the options will be sorted by their descriptions.

<% if action = "edit" then %> Option Groups - This is a list of Option Groups that this Option is currently linked to. To add the Option to another Option Group, use the Option Groups function.

<% end if %>
<% end if call closedb() %> <% '********************************************************************* 'Display common form fields '********************************************************************* sub commonFields() %>
Description Price Percentage Weight Tax Exempt? Sort Order <% if action = "edit" then %>

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