NY Giants Football Team Adding Product
Admin > Adding Product > Product Relationships > Log Off
Product ID
Show Product   
Supplier SKU or Unique ID
Product Name
Product Category   (Apply/Exit Buttons are all the same)
Product Code
Product Description
 
Price
Weight
Cost
Length
Width
Quantity in stock (-1) for no inventory control
Date Available
Leave User Option field blank if there are no options.
The User Option format is very important (example):
  Select Color ,Black,Red
 "Select" must be the 1st 6 characters
This will be presented to the user as:
 Select Color
 Black
 Red
 Select Options for NY Giants Football Team
User Option 0 
User Option 1 
User Option 2 
User Option 3 
User Option 4 
User Option 5 
User Option 6 
User Option 7 
User Option 8 
User Option 9 
Image Name
 
Turn ON/OFF Source Display (One Level deep include files are also shown)
<!-- #include file="../DatabaseInclude.asp" -->
This include file is NOT output to debug file.<%
eMsg = ""
strFunc = ucase(Request.QueryString("Function"))
Session("sesFunc")=strFunc
ProdID = Request.QueryString("ProdID")
eMsg = Request.QueryString("Msg")

if strFunc = "EDIT" then
  If ProdID = "" Then
    RESPONSE.REDIRECT "../error.asp?msg=" & Server.URLEncode ("Product ID is blank.")
  End If
    
  Set rsProducts = Server.CreateObject ("adodb.Recordset")

  rsProducts.Open "products", dbc, adOpenForwardOnly, adLockReadOnly, adCmdTable
  rsProducts.Filter = "catalogID = '" & ProdID & "'"

  Session("sesProdID") = rsProducts("catalogID")

  strCatalogid = rsProducts("Catalogid")
  strCcode = rsProducts("Ccode")
  strCname = rsProducts("Cname")
  strSupplierSKU = rsProducts("Suppliersku")
  strSKUName = rsProducts("Sku Name")
  strCimageurl = rsProducts("Cimageurl")
  strManufacturerName = rsProducts("Manufacturer Name")
  strManufacturerNumber = rsProducts("Manufacturer Number")
  strCdescription = rsProducts("cdescription")
  strShelfCase = rsProducts("Shelf/case")
  strCatalogPage = rsProducts("Catalog Page")
  strCweight = rsProducts("Cweight")
  strPkgQty = rsProducts("Pkg Qty")
  strUnitOfMeasure = rsProducts("Unit Of Measure")
  if rsProducts("cCost") = "" then
    strCcost= 0
  else        
    strCcost=rsProducts("cCost")
  end if    
  
  str2ndColPriceBBC = rsProducts("2nd Col Price Bbc")
  strCaseQty = rsProducts("Case Qty")
  strUpcCode1 = rsProducts("Upc Code 1")
  strBBCCategory1 = rsProducts("Bbc Category 1")
  strBBCCategory2 = rsProducts("Bbc Category 2")
  strBBCCategory3 = rsProducts("Bbc Category 3")
  strUnspsc = rsProducts("Unspsc#")
  if rsProducts("cPrice") = "" then
    strCPrice=0
  else    
    strCPrice=rsProducts("cPrice")
  end if
  strCdateavailable = rsProducts("Cdateavailable")
  strClength = rsProducts("Clength")
  strCwidth = rsProducts("Cwidth")
  strCcategory = rsProducts("Ccategory")
  strCcategoryname = rsProducts("Ccategoryname")
  strCstock = rsProducts("Cstock")
  strCuser0 = rsProducts("Cuser0")
  strCuser1 = rsProducts("Cuser1")
  strCuser2 = rsProducts("Cuser2")
  strCuser3 = rsProducts("Cuser3")
  strCuser4 = rsProducts("Cuser4")
  strCuser5 = rsProducts("Cuser5")
  strCuser6 = rsProducts("Cuser6")
  strCuser7 = rsProducts("Cuser7")
  strCuser8 = rsProducts("Cuser8")
  strCuser9 = rsProducts("Cuser9")
  strcShowProduct = rsProducts("cShowProduct")
'END FOR EDIT
else
  'MUST BE ADD
  if Session("ProductFormError") <> "yes" then
    ' Wittco New
  strCatalogid = ""
  strCcode = ""
  strCname = "Added Product"
  time6Characters= hour(now()) & minute(now()) & second(now())
  month2Characters = month(now())
  if month2Characters <10 then
    month2Characters = "0" & month2Characters
  end if
  day2Characters = day(now())
  if day2Characters <10 then
    day2Characters = "0" & day2Characters
  end if
  year4Characters = year(now())
  strDate = year4Characters & month2Characters & day2Characters & time6Characters
  strSupplierSKU = cstr(strDate) & Cstr (int (strDate *Rnd) )
  strSKUName = ""
  strCimageurl = ""
  strManufacturerName = ""
  strManufacturerNumber = ""
  strCdescription = " "
  strShelfCase = ""
  strCatalogPage = 0
  strCweight = 0
  strPkgQty = 0
  strUnitOfMeasure = ""
  strcCost = 0
  str2ndColPriceBBC = 0
  strCaseQty = 0
  strUpcCode1 = ""
  strBBCCategory1 = "Dummy Filler"
  strBBCCategory2 = ""
  strBBCCategory3 = ""
  strUnspsc = 0
  strcPrice = 0
  strCdateavailable = now()
  strClength = 0
  strCwidth = 0
  strCcategoryname = ""
  strCstock = -1
  strCcategory = ""
  strCuser0 = ""
  strCuser1 = ""
  strCuser2 = ""
  strCuser3 = ""
  strCuser4 = ""
  strCuser5 = ""
  strCuser6 = ""
  strCuser7 = ""
  strCuser8 = ""
  strCuser9 = ""
  strcShowProduct = "yes"
'END OF CODE IF WE DIDN'T HAVE A PREVIOUS ERROR
else
  ' IF WE DID HAVE A PREVIOUS ERROR, LOAD UP THE FIELDS SO THE
  ' USER DOESN'T HAVE TO ENTER ALL THE INFORMATION AGAIN (I HATE DOING THAT)
  strCatalogid = Session("Catalogid")
  strCcode = Session("Ccode")
  strCname = Session("Cname")
  strSupplierSKU = Session("Suppliersku")
  strSKUName = Session("SkuName")
  strCimageurl = Session("Cimageurl")
  strManufacturerName = Session("ManufacturerName")
  strManufacturerNumber = Session("ManufacturerNumber")
  strCdescription = Session("cdescription")
  strShelfCase = Session("ShelfCase")
  strCatalogPage = Session("CatalogPage")
  strCweight = Session("Cweight")
  strPkgQty = Session("PkgQty")
  strUnitOfMeasure = Session("UnitOfMeasure")
  strCcost=Session("cCost")  
  str2ndColPriceBBC = Session("2ndColPriceBbc")
  strCaseQty = Session("CaseQty")
  strUpcCode1 = Session("UpcCode1")
  strBBCCategory1 = Session("BbcCategory1")
  strBBCCategory2 = Session("BbcCategory2")
  strBBCCategory3 = Session("BbcCategory3")
  strUnspsc = Session("Unspsc")
  strCPrice = Session("cPrice")
  strCdateavailable = Session("Cdateavailable")
  strClength = Session("Clength")
  strCwidth = Session("Cwidth")
  strCcategoryname = Session("Ccategoryname")
  strCstock = Session("Cstock")
  strCcategory = Session("Ccategory")
  strCuser0 = Session("Cuser0")
  strCuser1 = Session("Cuser1")
  strCuser2 = Session("Cuser2")
  strCuser3 = Session("Cuser3")
  strCuser4 = Session("Cuser4")
  strCuser5 = Session("Cuser5")
  strCuser6 = Session("Cuser6")
  strCuser7 = Session("Cuser7")
  strCuser8 = Session("Cuser8")
  strCuser9 = Session("Cuser9")
  strcShowProduct = Session("cShowProduct")
  end if
end if
Redim strCUserArray(10)
count = 0
strCUserArray(count) = strCuser0:count = count + 1
strCUserArray(count) = strCuser1:count = count + 1
strCUserArray(count) = strCuser2:count = count + 1
strCUserArray(count) = strCuser3:count = count + 1
strCUserArray(count) = strCuser4:count = count + 1
strCUserArray(count) = strCuser5:count = count + 1
strCUserArray(count) = strCuser6:count = count + 1
strCUserArray(count) = strCuser7:count = count + 1
strCUserArray(count) = strCuser8:count = count + 1
strCUserArray(count) = strCuser9:count = count + 1
%>

<table class="TableSkins">
  <%if eMsg <> "" then%>
    <tr>
      <td class="TDSkins" colspan="2">
        <p align="center"><font color="#CC3300">
        <b><%=eMsg%>
        <img border="0" src="../Images/MiniRedArrow.gif"></b></font></td>
    </tr>
  <%end if%>
  <!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{

if (theForm.cname.value == "")
{
alert("Please enter a value for the \"Product Name\" field.");
theForm.cname.focus();
return (false);
}

if (theForm.cdescription.value == "")
{
alert("Please enter a value for the \"cdescription\" field.");
theForm.cdescription.focus();
return (false);
}

if (theForm.cdescription.value.length < 1)
{
alert("Please enter at least 1 characters in the \"cdescription\" field.");
theForm.cdescription.focus();
return (false);
}

if (theForm.cprice.value == "")
{
alert("Please enter a value for the \"Price\" field.");
theForm.cprice.focus();
return (false);
}

var checkOK = "0123456789-.";
var checkStr = theForm.cprice.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"Price\" field.");
theForm.cprice.focus();
return (false);
}

if (decPoints > 1

!validGroups)
{
alert("Please enter a valid number in the \"cprice\" field.");
theForm.cprice.focus();
return (false);
}

var checkOK = "0123456789-";
var checkStr = theForm.cweight.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"cweight\" field.");
theForm.cweight.focus();
return (false);
}

var checkOK = "0123456789-.";
var checkStr = theForm.cCost.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"cCost\" field.");
theForm.cCost.focus();
return (false);
}

if (decPoints > 1

!validGroups)
{
alert("Please enter a valid number in the \"cCost\" field.");
theForm.cCost.focus();
return (false);
}

var checkOK = "0123456789-";
var checkStr = theForm.cLength.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"cLength\" field.");
theForm.cLength.focus();
return (false);
}

var checkOK = "0123456789-";
var checkStr = theForm.cWidth.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"cWidth\" field.");
theForm.cWidth.focus();
return (false);
}

var checkOK = "0123456789-";
var checkStr = theForm.cstock.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"cstock\" field.");
theForm.cstock.focus();
return (false);
}

var chkVal = allNum;
var prsVal = parseInt(allNum);
if (chkVal != "" && !(prsVal > "-2"))
{
alert("Please enter a value greater than \"-2\" in the \"cstock\" field.");
theForm.cstock.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" action="ProductWrite.asp?Keyword=<%=Request.QueryString("keyword")%>&SI=<%=Request.QueryString("SI")%>&SO=<%=Request.QueryString("SO")%>&SM=<%=Request.QueryString("SM")%>&SD=<%=Request.QueryString("SD")%>&SCP=<%=Request.QueryString("SCP")%>&SQ=<%=Request.QueryString("SQ")%>&SE=<%=Request.QueryString("SE")%>" name="FrontPage_Form1" language="JavaScript" onsubmit="return FrontPage_Form1_Validator(this)">
  <!form method="POST" action="../ShowAllFormItems.asp?Keyword=<%=Request.QueryString("keyword")%>&SI=<%=Request.QueryString("SI")%>&SO=<%=Request.QueryString("SO")%>&SM=<%=Request.QueryString("SM")%>&SD=<%=Request.QueryString("SD")%>&SCP=<%=Request.QueryString("SCP")%>&SQ=<%=Request.QueryString("SQ")%>&SE=<%=Request.QueryString("SE")%>" name="FrontPage_Form1" language="JavaScript" onsubmit="return FrontPage_Form1_Validator(this)">
    
    <input type="hidden" value="<%=strSupplierSKU%>" name="OriginalSupplierSKU" size="50" tabindex="1">
    <input type="hidden" value="<%=ProdID%>" name="Catalogid" size="50" tabindex="1">
    
    
    <tr>
      <td class="TDHeader" colspan="2">
        <%=Session("CompanyName")%>
        <%if strFunc = "ADD" then%>
          Adding Product
        <%else%>
          Editing Product
        <%end if%>
        <%= ProdID%>
      </td>
    </tr>
    
    <tr>
      <td class="TDHeader" colspan="2">
        <a href="Index.asp">Admin</a>
          <%if strFunc = "ADD" then%> > Adding Product
        <% else %>
          > <a href="ProductList.asp">Select Product to EDIT</a>  > Editing Product
        <% end if %> > <a href="ProductRelationships.asp">Product Relationships</a> >
        <a href="SessionClose.asp">Log Off</a>
      </td>
    </tr>
    <%if strFunc <> "ADD" then%>
      <tr>
        <td class="TDSkins" colspan="2">
          <input type="submit" value="Remove" name="submit_changes" tabindex="24" style="color: #CC3300" class="InputSkins"></td>
      </tr>
    <%end if%>
    
    <tr>
      <td class="TDSkinsRight">
        Product ID
      </td>
      <td>
        <%if strFunc = "EDIT" then%>
          <%=rsProducts("catalogID")%>
          (System assigned.)
          <%if strFunc <> "ADD" then%>
            <input type="submit" value="Clone This Product" name="submit_changes" tabindex="21" class="InputSkins">
          <%end if%>
        <%end if%>
      </td>
      
    </tr>
    <tr>
      <td class="TDSkinsRight">
        Show Product
      </td>
      <td class="TDSkins">
        <input type="text" value="<%=strcShowProduct%>" name="cShowProduct" size="29" tabindex="1" class="InputSkins">  
      </td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
        Supplier SKU or Unique ID </td>
      <td class="TDSkins">
        <input class="InputSkins" type="text" name="SupplierSKU" size="50" tabindex="1"
        <%if ucase(Session("clone")) = "YES" then
          Session ("Clone") = ""%>

          value=""
        <%else%>
          value="<%=strSupplierSKU%>"
        <%end if%>></td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
        Product Name
      </td>
      <td class="TDSkins">
        <!--webbot bot="Validation" s-display-name="Product Name" b-value-required="TRUE" --><input class="InputSkins" type="text" value="<%=strCName%>" name="cname" size="60" tabindex="1">
      </td>
    </tr>

    <tr>
      <td class="TDSkinsRight">
        Product Category
      </td>
      <td class="TDSkins">
        <select class="SelectSkins" input type="number" name="ccategoryName" tabindex="2" size="1">
        <option value="Select a category">Select a category</option>
        <%
        'create recordset to show categories from database
        Dim rsCategories, SQLstr
        strProduct = "product"
        Set rsCategories = Server.CreateObject ("ADODB.Recordset")
        'rsCategories.Filter = "categoryType <> " & "product"
        
        
        SQLstr = "SELECT categories.* "
        SQLstr = SQLstr & " FROM categories "
        'SQLstr = SQLstr & " WHERE (((categories.categoryType)=" & strProduct & "))"
        SQLstr = SQLstr & " ORDER BY catdescription"
        SQLstr = SQLstr & " ;"
        session("SQLstr") = SQLstr
        rsCategories.Open SQLstr, dbc
        
        While Not rsCategories.EOF
          if ucase(rsCategories("categoryType")) = ucase("product") then
            if tempCatDescription <> rsCategories("catDescription") then%>

                <option value="<%= rsCategories("catDescription") %>" <% if strccategoryname = rscategories("catdescription") then%>
                selected
            <%end if%>>
              <%=rsCategories("catdescription") %></option>
            <%end if
            tempCatDescription = rsCategories("catDescription")
          end if
          rsCategories.MoveNext
        Wend%>

        </select>  (Apply/Exit Buttons are all the same)
      </td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
        Product Code
      </td>
      <td class="TDSkins">
        <input class="InputSkins" type="text" value="<%= strCCode%>" name="ccode" size="25" tabindex="3">
        <input class="InputSkins" type="submit" value="Apply Changes" name="submit_changes" tabindex="21"></td>
    </tr>
    
    <tr>
      <td class="TDSkins" colspan=2>
        Product Description
      </td>
    </tr>
    
    <tr>
      <td class="TDSkins" colspan=2>
 <!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1" --><textarea class="TextAreaSkins" rows="5" name="cdescription" cols="103" tabindex="4"><%if ucase(strFunc) = "EDIT" then%>
<%=strCdescription%><%end if%></textarea>
      </td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
          Price
      </td>
      <td class="TDSkins">
        <!--webbot bot="Validation" s-display-name="Price" s-data-type="Number" s-number-separators="x." b-value-required="TRUE" --><input type="text" name="cprice" size="20" value="<%=FormatNumber(strCPrice,2)%>" class="InputSkins">
      </td>
    </tr>
    
    <tr>      
      <td class="TDSkinsRight">
        Weight
      </td>
      <td class="TDSkins">
        <!--webbot bot="Validation" s-data-type="Integer" s-number-separators="x" --><input type="text" name="cweight" size="20" value="<%=strCweight%>" tabindex="7" class="InputSkins">
      </td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
        Cost
      </td>
      <td class="TDSkins">
          <!--webbot bot="Validation" s-data-type="Number" s-number-separators="x." --><input type="text" name="cCost" size="20" value="<%= FormatNumber(strCcost,2) %>" class="InputSkins">
      </td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
        Length
      </td>
      <td class="TDSkins">
        <!--webbot bot="Validation" s-data-type="Integer" s-number-separators="x" --><input type="text" name="cLength" size="20" value="<%=strClength%>" tabindex="7" class="InputSkins">
      </td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
        Width
      </td>
      <td class="TDSkins">
        <!--webbot bot="Validation" s-data-type="Integer" s-number-separators="x" --><input type="text" name="cWidth" size="20" value="<%=strCwidth%>" tabindex="8" class="InputSkins">
      </td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
        Quantity in stock
      </td>
      <td class="TDSkins">
        <!--webbot bot="Validation" s-data-type="Integer" s-number-separators="x" s-validation-constraint="Greater than" s-validation-value="-2" --><input type="text" name="cstock" size="20" value="<%=strCstock%>" tabindex="8" class="InputSkins">
        (-1) for no inventory control
      </td>
    </tr>
    
    <tr>
      <td class="TDSkinsRight">
        Date Available
      </td>
      <td class="TDSkins">
        <input type="text" name="cdateavailable" size="20" value="<%=strCdateavailable %>" tabindex="9" class="InputSkins">
      </td>
    </tr>
    
    <tr>
      <td class="TDSkins">
      Leave User Option field blank if there are no options.<br>
      The User Option format is very important (example):<br>
          Select Color ,Black,Red<br>
         "Select" must be the 1st 6 characters</td>
      <td class="TDSkins">
        This will be presented to the user as:<br>
         Select Color<br>
         Black<br>
         Red<br>
         Select Options for <%=Session("Companyname")%>
      </td>
    </tr>

      <%for x = 0 TO 9%>
          <tr>
            <td class="TDSkinsRight">User Option <%=x%> </td>
            <td class="TDSkins">
              <input class="InputSkins" type="text" value="<%=strCUserArray(x)%>" name="cUser<%=x%>" size="74">
            </td>
          </tr>
      <%next%>

    <tr>
      <td class="TDSkinsRight">
        Image Name
      </td>
      <td class="TDSkins">
        <input type="text" value="<%=strCimageURL%>" name="cimageurl" size="74" tabindex="20" class="InputSkins">
        <br>
        <% if strCimageURL <> "" then %>
          <%MultipleImages = split(rsProducts("cimageurl"),",")%>
          <% for x = LBound(MultipleImages) to UBound(MultipleImages)%>
            <img src="../ProductImages/<%=MultipleImages(x)%>">
          <%next%>
        <%end if%>
      </td>
    </tr>
    
    <tr>    
      <td class="TDSkins">
         </td>
      
      <td class="TDSkins">
        <input type="submit" value="Apply Changes" name="submit_changes" tabindex="21" class="InputSkins">
        <input type="submit" value="Exit/Do Nothing" name="submit_changes" tabindex="23" class="InputSkins">
      </td>          
    </tr>
    
  </form>
</table>
<%
if strFunc = "EDIT" then
  'rsProducts.close
  'set rsProducts= nothing
  'dbc.close
  'set dbc= nothing
end if
Session("ProductFormError") = ""
%>
<!-- #include file="../ReadFile.asp" -->
This include file is NOT output to debug file.