<%@ Language=VBScript %> <% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : Shipping Rates 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, rs2 'ShipRates dim idShip dim idShipMethod dim locShipZone dim unitType dim unitsFrom dim unitsTo dim addAmt dim addPerc 'ShipMethod dim shipDesc dim status 'Work Fields dim I dim item dim count dim pageSize dim totalPages dim showArr dim curPage dim showShipMet dim showShipZone dim showType '************************************************************************* '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 'Set Row Colors dim rowColor, col1, col2 col1 = "#DDDDDD" col2 = "#EEEEEE" 'Set Number of Items per Page pageSize = 50 'Get Page to show curPage = Request.Form("curPage") 'Form if len(curPage) = 0 then curPage = Request.QueryString("curPage") 'QueryString end if 'Get showShipMet showShipMet = Request.Form("showShipMet") 'Form if len(showShipMet) = 0 then showShipMet = Request.QueryString("showShipMet") 'QueryString end if 'Get showShipZone showShipZone = Request.Form("showShipZone") 'Form if len(showShipZone) = 0 then showShipZone = Request.QueryString("showShipZone") 'QueryString end if 'Get showType showType = Request.Form("showType") 'Form if len(showType) = 0 then showType = Request.QueryString("showType") 'QueryString end if 'Check if a Cookie Reset was requested if Request.QueryString("resetCookie") = "1" then Response.Cookies("ShipSearch").expires = Date() - 30 else 'Check if a Cookie Recall was requested if Request.QueryString("recallCookie") = "1" then for each item in Request.Cookies if item = "ShipSearch" then showArr = Split(Request.Cookies(item),"*|*") curPage = showArr(0) showShipMet = showArr(1) showShipZone= showArr(2) showType = showArr(3) end if next else 'Save Search Criteria in a Cookie Response.Cookies("ShipSearch") = navCookie(curPage) Response.Cookies("ShipSearch").expires = Date() + 30 end if end if 'After attempting to retrieve the search criteria through the various 'mechanisms above (Form/QueryString/Cookie), check that some of the 'critical values are valid. If not, set to default values. if len(curPage) = 0 or not isNumeric(curPage) then curPage = 1 else curPage = CLng(curPage) end if %>

Shipping - Store Rates Maintenance

<% 'Page Tabs call shipTabs("CR") if len(trim(Request.QueryString("msg"))) > 0 then %> <%=Request.QueryString("msg")%>

<% end if %>
Add Shipping Rate
     

<% 'Specify fields and table mySQL="SELECT idShip,shipRates.idShipMethod,locShipZone," _ & " unitType,unitsFrom,unitsTo,addAmt,addPerc, " _ & " shipMethod.shipDesc " _ & "FROM shipRates, shipMethod " _ & "WHERE shipRates.idShipMethod = shipMethod.idShipMethod " 'Shipping Method if len(showShipMet) > 0 then mySQL = mySQL & "AND shipRates.idShipMethod = " & showShipMet & " " end if 'Shipping Zone if len(showShipZone) > 0 then mySQL = mySQL & "AND locShipZone = " & showShipZone & " " end if 'Shipping Rate Type if len(showType) > 0 then mySQL = mySQL & "AND unitType = '" & showType & "' " end if 'Sort Order mySQL = mySQL & "ORDER BY shipDesc,locShipZone,unitType," _ & " unitsFrom,unitsTo" set rs = openRSopen(mySQL,0,adOpenStatic,adLockReadOnly,adCmdText,pageSize) if rs.eof then %> <% else rs.MoveFirst rs.PageSize = pageSize totalPages = rs.PageCount rs.AbsolutePage = curPage %> <% rowColor = col2 do while not rs.eof and count < rs.pageSize %> <% count = count + 1 rs.movenext 'Switch Row Color if rowColor = col2 then rowColor = col1 else rowColor = col2 end if loop %> <% end if call closeRS(rs) %>

No Shipping Rates matched search criteria.

<% call pageNavigation("selectPageTop") %>
Shipping Method Zone Type From To Amount Perc.  
<%=rs("shipDesc")%>  <%=rs("locShipZone")%>  <% select case UCase(rs("unitType")) case "P" Response.Write "Price" case "W" Response.Write "Weight" case else Response.Write "Unknown" end select %> <%=rs("unitsFrom")%>  <%=rs("unitsTo")%>  <% if isNull(rs("addAmt")) then Response.Write "-" else Response.Write moneyD(rs("addAmt")) end if %> <% if isNull(rs("addPerc")) then Response.Write "-" else Response.Write rs("addPerc") & "%" end if %> [ ">edit ] ">
<% call pageNavigation("selectPageBot") %> Delete Selected Shipping Rates?

Help and Instructions :
Overview - Store Shipping Rates are specified for each unique Store Shipping Method and Zone combination. Shipping Rates are applied to an order based on the order's total Weight and/or Price range. This allows for a tremendous amount of flexibility. You can also specify if the shipping rate for the order must be calculated as a fixed amount, or a percentage of the order total.

It is also possible to specify both a fixed amount AND a percentage for a specific price/weight range. In these cases, the system will display the higher value of the two calculations.

Example
  • FedEx Ground (Shipping Method)
    • USA & Canada (Zone 1)
      • Shipping Rates based on total Order Amount
        • $000.00 to $100.00 -> add $10.00 to order
        • $100.01 to $200.00 -> add $15.00 to order
        • $200.01 to $500.00 -> add $20.00 to order
        • etc.
      • Shipping Rates based on Order Weight (Pounds, Kilograms, etc.)
        • 00 to 10 -> add $12.50 to order
        • 11 to 20 -> add $14.50 to order
        • 21 to 30 -> add $17.00 to order
        • etc.
    • Europe (Zone 2)
      • Shipping Rates based on Order Weight (Pounds, Kilograms, etc.)
        • 00 to 10 -> add 10.00% to order
        • 11 to 20 -> add 12.50% to order
        • 21 to 30 -> add 15.00% to order
        • etc.
<% call closedb() %> <% '********************************************************************* 'Make QueryString for Paging '********************************************************************* function navQueryStr(pageNum) navQueryStr = "?curPage=" & server.URLEncode(pageNum) _ & "&showShipMet=" & server.URLEncode(showShipMet) _ & "&showShipZone=" & server.URLEncode(showShipZone) _ & "&showType=" & server.URLEncode(showType) end function '********************************************************************* 'Make Cookie Value for Paging '********************************************************************* function navCookie(pageNum) navCookie = pageNum & "*|*" _ & showShipMet & "*|*" _ & showShipZone & "*|*" _ & showType end function '********************************************************************* 'Display page navigation '********************************************************************* sub pageNavigation(formFieldName) Response.Write "Page " Response.Write " of " & TotalPages & "  " Response.Write "[ " if curPage > 1 then Response.Write "Back" else Response.Write "Back" end if Response.Write " | " if curPage < TotalPages then Response.Write "Next" else Response.Write "Next" end if Response.Write " ]" end sub %>