PDA

View Full Version : Need a little .ASP assistance (novice). Pictures inside


BlackReef
08-14-2010, 12:35 AM
Hello,

So, I have been playing around with this for awhile now, trying to move snippets of .asp code around to try and reorganize these 'option' boxes.

Basically, there are (2) product option dropdown boxes. Currently these are located above the 'Add to Cart' are. We are trying to align them so they are horizontally flush with the add to cart.

Please see examples below:

Currently:
http://blackreefdesigns.com/misc/example.jpg


And the way we are trying to get it:
http://blackreefdesigns.com/misc/example1.jpg

Any time we make changes - it prompts an .ASP error, and my custom .ASP programmer is out of town for the next week.

Is this relatively simple to do, or is this going to take some time?

Here is the code:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Options (N)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Sub pcs_OptionsN
' SELECT DATA SET
' TABLES: products, pcProductsOptions, optionsgroups, ptions_optionsGroups
query = "SELECT DISTINCT optionsGroups.OptionGroupDesc, pcProductsOptions.idOptionGroup, pcProductsOptions.pcProdOpt_Required, pcProductsOptions.pcProdOpt_Order "
query = query & "FROM products "
query = query & "INNER JOIN ( "
query = query & "pcProductsOptions INNER JOIN ( "
query = query & "optionsgroups "
query = query & "INNER JOIN options_optionsGroups "
query = query & "ON optionsgroups.idOptionGroup = options_optionsGroups.idOptionGroup "
query = query & ") ON optionsGroups.idOptionGroup = pcProductsOptions.idOptionGroup "
query = query & ") ON products.idProduct = pcProductsOptions.idProduct "
query = query & "WHERE products.idProduct=" & pidProduct &" "
query = query & "AND options_optionsGroups.idProduct=" & pidProduct &" "
query = query & "ORDER BY pcProductsOptions.pcProdOpt_Order, optionsGroups.OptionGroupDesc;"
set rs=server.createobject("adodb.recordset")
set rs=conntemp.execute(query)
if err.number<>0 then
call LogErrorToDatabase()
set rs=nothing
call closedb()
response.redirect "techErr.asp?err="&pcStrCustRefID
end if
' If we have data
if NOT rs.eof then
pcv_intOptionGroupCount = 0 '// keeps count of the number of options
xOptionsCnt = 0 '// keeps count of the number of required options
do until rs.eof

'if pcv_intOptionGroupCount <= 5 then ' // start limit to 5 options
'// Get the Group Name
pcv_strOptionGroupDesc=rs("OptionGroupDesc")
'// Get the Group ID
pcv_strOptionGroupID=rs("idOptionGroup")
'// Is it required
pcv_strOptionRequired=rs("pcProdOpt_Required")

'// Start: Do Option Count
pcv_intOptionGroupCount = pcv_intOptionGroupCount + 1
'// End: Do Option Count

'// Get the number of the Option Group
pcv_strOptionGroupCount = pcv_intOptionGroupCount

'// Start: Do Required Option Count AND generate validation string
if IsNull(pcv_strOptionRequired) OR pcv_strOptionRequired="" then
pcv_strOptionRequired=0 '// not required // else it is "1"
end if
if pcv_strOptionRequired=1 then

' Keep Tally
xOptionsCnt = xOptionsCnt + 1

' Generate String
if xOtionrequired="1" then
pcv_strReqOptString = pcv_strReqOptString & ","
end if

xOtionrequired="1"
pcv_strOptionGroupDesc2=pcv_strOptionGroupDesc
pcv_strOptionGroupDesc2=replace(pcv_strOptionGroupDesc2,"'","")
pcv_strOptionGroupDesc2=replace(pcv_strOptionGroupDesc2,"""","\'\'")
pcv_strReqOptString = pcv_strReqOptString & "document.additem.idOption" & pcv_strOptionGroupCount & ".selectedIndex,'"& pcv_strOptionGroupDesc2 &"'"

end if
'// End: Do Required Option Count

'// Make the Option Box
pcs_makeOptionBox

'end if ' // end limit to 5 options
rs.movenext
loop
end if
set rs=nothing
%>
<input type="hidden" name="OptionGroupCount" value="<%=pcv_intOptionGroupCount%>">
<%
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Options (N)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Options Box
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Sub pcs_makeOptionBox
' SELECT DATA SET
' TABLES: options_optionsGroups, options
query = "SELECT options_optionsGroups.InActive, options_optionsGroups.price, options_optionsGroups.Wprice, "
query = query & "options_optionsGroups.idoptoptgrp, options.idoption, options.optiondescrip "
query = query & "FROM options_optionsGroups "
query = query & "INNER JOIN options "
query = query & "ON options_optionsGroups.idOption = options.idOption "
query = query & "WHERE options_optionsGroups.idOptionGroup=" & pcv_strOptionGroupID &" "
query = query & "AND options_optionsGroups.idProduct=" & pidProduct &" "
query = query & "ORDER BY options_optionsGroups.sortOrder, options.optiondescrip;"
set rs2=server.createobject("adodb.recordset")
set rs2=conntemp.execute(query)
if err.number<>0 then
call LogErrorToDatabase()
set rs2=nothing
call closedb()
response.redirect "techErr.asp?err="&pcStrCustRefID
end if

' If we have data
if NOT rs2.eof then

'// clean up the option group description
if pcv_strOptionGroupDesc<>"" then
pcv_strOptionGroupDesc=replace(pcv_strOptionGroupDesc,"""","&quot;")
end if

'// START SELECT
pcv_isOptionSelected="" '// Is this option box selected? Fill variable to "1" during the following loop.
%>
<div><%=pcv_strOptionGroupDesc%>:</div>
<select name="idOption<%=pcv_strOptionGroupCount%>" style="margin-top: 3px;">
<%
'// Only execute when the Remove Option Feature is activated.
if pcv_strRemoveFeature<>"1" then %>
<option value=""><%=dictLanguage.Item(Session("language")&"_viewPrd_61")%></option>
<% end if %>
<%
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Start Loop
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
do until rs2.eof

OptInActive=rs2("InActive") ' Is it active?
if IsNull(OptInActive) OR OptInActive="" then
OptInActive="0"
end if

dblOptPrice=rs2("price") '// Price
dblOptWPrice=rs2("Wprice") '// WPrice
intIdOptOptGrp=rs2("idoptoptgrp") '// The Id of the Option Group
intIdOption=rs2("idoption") '// The Id of the Option
strOptionDescrip=rs2("optiondescrip") '// A description of the Option

'**************************************************************************************************
' START: Dispay the Options
'**************************************************************************************************
if OptInActive="0" then
If session("customerType")=1 then
optPrice=dblOptWPrice
Else
optPrice=dblOptPrice
End If
%>
<option value="<%=intIdOptOptGrp%>"
<%
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Check if Option should be Selected
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim xIdOptCounter

if tIndex<>0 then ' Check they are updating the product after adding it to the shopping cart
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pcCartArray=session("pcCartSession")
tempIdOpt = ""
tempIdOpt = pcCartArray(tIndex,11)

if tempIdOpt = "" then
response.write ">"
else
tempIdOpt = Split(trim(tempIdOpt),chr(124))
for xIdOptCounter = 0 to Ubound(tempIdOpt)
if clng(intIdOptOptGrp) = clng(tempIdOpt(xIdOptCounter)) then
response.write " selected"
end if
next
response.write ">"
end if

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
else
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tempIdOpt = ""
tempIdOpt = request.querystring("idOptionArray")

if tempIdOpt = "" then
response.write ">"
else
tempIdOpt = Split(trim(tempIdOpt),chr(124))
for xIdOptCounter = 0 to Ubound(tempIdOpt)
if clng(intIdOptOptGrp) = clng(tempIdOpt(xIdOptCounter)) then
response.write " selected"
pcv_isOptionSelected="1"
end if
next
response.write ">"
end if

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Check if Option should be Selected
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Display Option Name
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
response.write strOptionDescrip & "&nbsp;"
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Display Option Name
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Display Pricing
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if optPrice>0 then
'// If there is a price thats greater than zero
%>
<%=" - " &dictLanguage.Item(Session("language")&"_prodOpt_1")&" "&scCurSign& money(optPrice)%>
<%
end if %>
<%
if optPrice<0 then
'// If there is not a price
%>
<%=" - " &dictLanguage.Item(Session("language")&"_prodOpt_2")&" "&scCurSign& money(optPrice)%>
<%
end if

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Display Pricing
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%>
</option>
<%
end if
'**************************************************************************************************
' END: Dispay the Options
'**************************************************************************************************
rs2.movenext
loop

'// Only execute when the Remove Option Feature is activated.
if pcv_strAdminPrefix="1" AND pcv_strRemoveFeature="1" then %>
<% if pcv_isOptionSelected="1" then %>
<option value=""></option>
<option value="">----- Remove Option -----</option>
<% else %>
<option value="" selected><%=dictLanguage.Item(Session("language")&"_viewPrd_61")%></option>
<% end if %>
<% end if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END Loop
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end if
set rs2=nothing
%>
</select>
<br />
<br />
<%
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Options Box
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Any help on this would be GREATLY appreciated,

Thanks

Old Pedant
08-14-2010, 02:37 AM
You certainly aren't showing enough of the relevant code there.

You aren't even showing where the <input> for the quantity is or the image (or whatever) is being used for the "Add to Gear".

So who can guess?

That looks to me like it's some sort of "boilerplate" shopping cart code, not something custom done for your shop, which probably explains why it's hard to modify.

But in any case, if you are *ONLY* modifying the code shown there, then it's clearly not enough. Because it needs to slip into the code for the <input> for quantity and the "Add" button.

I think you should wait until next week.

p.s.: It's pretty ugly ASP code. I would sure not want to be using it in my cart.

BlackReef
08-14-2010, 03:32 AM
You certainly aren't showing enough of the relevant code there.

You aren't even showing where the <input> for the quantity is or the image (or whatever) is being used for the "Add to Gear".

So who can guess?

That looks to me like it's some sort of "boilerplate" shopping cart code, not something custom done for your shop, which probably explains why it's hard to modify.

But in any case, if you are *ONLY* modifying the code shown there, then it's clearly not enough. Because it needs to slip into the code for the <input> for quantity and the "Add" button.

I think you should wait until next week.

p.s.: It's pretty ugly ASP code. I would sure not want to be using it in my cart.

I just pasted the excerpt from what I believe to be the 'options' section. If you would like I can post the entire page code, but I have a sense that it's not going to do any good

BlackReef
08-25-2010, 12:58 AM
Well, I can't edit my original post for some reason, but I have actually pinpointed the code exactly. (the code in the first post is not correct, sorry)

<select name="idOption<%=pcv_strOptionGroupCount%>" style="margin-top: 3px;">
<%
'// Only execute when the Remove Option Feature is activated.
if pcv_strRemoveFeature<>"1" then %>
<option value=""><%=dictLanguage.Item(Session("language")&"_viewPrd_61")%></option>
<% end if %>
<%
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Start Loop
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
do until rs2.eof

OptInActive=rs2("InActive") ' Is it active?
if IsNull(OptInActive) OR OptInActive="" then
OptInActive="0"
end if

dblOptPrice=rs2("price") '// Price
dblOptWPrice=rs2("Wprice") '// WPrice
intIdOptOptGrp=rs2("idoptoptgrp") '// The Id of the Option Group
intIdOption=rs2("idoption") '// The Id of the Option
strOptionDescrip=rs2("optiondescrip") '// A description of the Option

'**************************************************************************************************
' START: Dispay the Options
'**************************************************************************************************
if OptInActive="0" then
If session("customerType")=1 then
optPrice=dblOptWPrice
Else
optPrice=dblOptPrice
End If
%>
<option value="<%=intIdOptOptGrp%>"
<%
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Check if Option should be Selected
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim xIdOptCounter

if tIndex<>0 then ' Check they are updating the product after adding it to the shopping cart
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pcCartArray=session("pcCartSession")
tempIdOpt = ""
tempIdOpt = pcCartArray(tIndex,11)

if tempIdOpt = "" then
response.write ">"
else
tempIdOpt = Split(trim(tempIdOpt),chr(124))
for xIdOptCounter = 0 to Ubound(tempIdOpt)
if clng(intIdOptOptGrp) = clng(tempIdOpt(xIdOptCounter)) then
response.write " selected"
end if
next
response.write ">"
end if

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
else
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tempIdOpt = ""
tempIdOpt = request.querystring("idOptionArray")

if tempIdOpt = "" then
response.write ">"
else
tempIdOpt = Split(trim(tempIdOpt),chr(124))
for xIdOptCounter = 0 to Ubound(tempIdOpt)
if clng(intIdOptOptGrp) = clng(tempIdOpt(xIdOptCounter)) then
response.write " selected"
pcv_isOptionSelected="1"
end if
next
response.write ">"
end if

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Check if Option should be Selected
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Display Option Name
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
response.write strOptionDescrip & "&nbsp;"
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Display Option Name
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Display Pricing
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if optPrice>0 then
'// If there is a price thats greater than zero
%>
<%=" - " &dictLanguage.Item(Session("language")&"_prodOpt_1")&" "&scCurSign& money(optPrice)%>
<%
end if %>
<%
if optPrice<0 then
'// If there is not a price
%>
<%=" - " &dictLanguage.Item(Session("language")&"_prodOpt_2")&" "&scCurSign& money(optPrice)%>
<%
end if

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Display Pricing
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%>
></option>
<%
end if
'**************************************************************************************************
' END: Dispay the Options
'**************************************************************************************************
rs2.movenext
loop

'// Only execute when the Remove Option Feature is activated.
if pcv_strAdminPrefix="1" AND pcv_strRemoveFeature="1" then %>
<% if pcv_isOptionSelected="1" then %>
<option value=""></option>
<option value="">----- Remove Option -----</option>
<% else %>
<option value="" selected><%=dictLanguage.Item(Session("language")&"_viewPrd_61")%></option>
<% end if %>
<% end if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END Loop
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end if
set rs2=nothing
%>
</select>

Again, all I need to do is get those lined up just to the right of the 'Add to Cart' as in the image mockup

Old Pedant
08-25-2010, 02:22 AM
Nope, still not enough code.

Need to *also* show the code *AFTER* that which displays the price, the quantity input box, and the ADD TO CART button.

Don't need to repeat the above code.

(And may I say, again, that is some of the worst written ASP code I have seen in 12 years of looking at ASP code. Not *the* worst. But it ranks up there.)

BlackReef
08-25-2010, 02:55 AM
Nope, still not enough code.

Need to *also* show the code *AFTER* that which displays the price, the quantity input box, and the ADD TO CART button.

Don't need to repeat the above code.

(And may I say, again, that is some of the worst written ASP code I have seen in 12 years of looking at ASP code. Not *the* worst. But it ranks up there.)

Well, like I said, I didn't write the code...but this is what I have to work with. I've tried to play with it to figure it out, but no dice.

Regardless, here is the rest of the code if you are interested, sir:


</div>

<br />
<%
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Options Box
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Add to Cart (Dynamic)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Sub pcs_AddtoCart
pcv_strFuntionCall = "cdDynamic"
%>
<table>
<tr>
<td valign="middle">
<%
if tIndex<>0 then '// Check they are updating the product after adding it to the shopping cart
pcCartArray=session("pcCartSession")
tempQty = ""
tempQty = pcCartArray(tIndex,2)
if tempQty<>"" then
pcv_intQuantityField=tempQty
else
pcv_intQuantityField=1
end if
else
if pcv_lngMinimumQty <> 0 then
pcv_intQuantityField=pcv_lngMinimumQty
else
pcv_intQuantityField=1
end if
end if
%>
<input type="text" class="quantitybox" name="quantity" size="5" maxlength="10" value="<%=pcv_intQuantityField%>">
</td>

<td valign="middle">
<input type="hidden" name="idproduct" value="<%=pidProduct%>">

<%
'// there is at least one reuqired custom field
if xrequired="1" then
%>

<%
If BTOCharges=0 then
if xOtionrequired = "1" then '// If there are any required options at all.
'// figure some stuff out
%>
<a href="" onClick="javascript: if (CheckRequiredCS('<%=pcv_strReqCSString%>')) {if (checkproqty(document.additem.quantity)) {<%=pcv_strFuntionCall%>(<%=pcv_strReqOptString%>,<%=reqstring%>,0);}} return false"><%showAddtoCart=1%><img border="0" src="<%=pcv_tmpNewPath%><%=rslayout("addtocart")%>" alt="<%=dictLanguage.Item(Session("language")&"_altTag_2b")%>"></a>
<%
else ' There are no required options at all.
%>
<a href="" onClick="javascript: if (CheckRequiredCS('<%=pcv_strReqCSString%>')) {if (checkproqty(document.additem.quantity)) {<%=pcv_strFuntionCall%>(<%=reqstring%>,0);}} return false"><%showAddtoCart=1%><img border="0" src="<%=pcv_tmpNewPath%><%=rslayout("addtocart")%>" alt="<%=dictLanguage.Item(Session("language")&"_altTag_2b")%>"></a>
<%
end if
end if
%>

<%
' There are no required custom fields.
else
%>

<%
If BTOCharges=0 then
if xOtionrequired = "1" then '// If there are any required options at all.
'// figure some stuff out
%>
<a href="" onClick="javascript: if (CheckRequiredCS('<%=pcv_strReqCSString%>')) {if (checkproqty(document.additem.quantity)) {<%=pcv_strFuntionCall%>(<%=pcv_strReqOptString%>,0);}} return false"><%showAddtoCart=1%><img border="0" src="<%=pcv_tmpNewPath%><%=rslayout("addtocart")%>" alt="<%=dictLanguage.Item(Session("language")&"_altTag_2b")%>"></a>
<% else %>
<%showAddtoCart=1%>
<input alt=Add src="<%=pcv_tmpNewPath%><%=rslayout("addtocart")%>" type=image name="add" border="0" id="submit">
<%
end if
End if
%>


<%
'// End ADD TO CART SECTION
end if
%>

<% If pserviceSpec<>0 then
Dim rsQ,queryQ
queryQ="SELECT TOP 1 configProduct FROM configSpec_products WHERE specProduct=" & pIdProduct & ";"
set rsQ=connTemp.execute(queryQ)
if err.number<>0 then
call LogErrorToDatabase()
set rsQ=nothing
call closedb()
response.redirect "techErr.asp?err="&pcStrCustRefID
end if
if not rsQ.eof then%>
<a href="javascript:document.additem.action='configurePrd.asp?idproduct=<%=pIdProduct%>&qty='+document.additem.quantity.value; document.additem.submit();">
<img src="<%=pcv_tmpNewPath%><%=rslayout("customize")%>" border="0" alt="<%=dictLanguage.Item(Session("language")&"_altTag_9")%>">
</a>
<%End if
set rsQ=nothing
End If %>
</td>
</tr>
</table>
<%
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Add to Cart (Dynamic)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Product Promotion
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Public Sub pcs_ProductPromotionMsg
Dim rs,rsQ,query,tmpStr
call opendb()

query="SELECT pcPrdPro_id,idproduct,pcPrdPro_QtyTrigger,pcPrdPro_DiscountType,pcPrdPro_DiscountValue,pcPrdPro_Appl yUnits,pcPrdPro_PromoMsg,pcPrdPro_ConfirmMsg,pcPrdPro_SDesc,pcPrdPro_IncExcCust,pcPrdPro_IncExcCPric e,pcPrdPro_RetailFlag,pcPrdPro_WholesaleFlag FROM pcPrdPromotions WHERE pcPrdPro_Inactive=0 AND idproduct=" & pIDProduct & ";"
set rsQ=connTemp.execute(query)
if not rsQ.eof then
pcv_HavePrdPromotions=1
PrdPromoArr=rsQ.getRows()
set rsQ=nothing
PrdPromoCount=ubound(PrdPromoArr,2)

tmpIDCode=PrdPromoArr(0,0)
tmpIDProduct=PrdPromoArr(1,0)
tmpQtyTrigger=clng(PrdPromoArr(2,0))
tmpDiscountType=PrdPromoArr(3,0)
tmpDiscountValue=PrdPromoArr(4,0)
tmpApplyUnits=PrdPromoArr(5,0)
tmpConfirmMsg=PrdPromoArr(7,0)
tmpDescMsg=PrdPromoArr(8,0)
pcIncExcCust=PrdPromoArr(9,0)
pcIncExcCPrice=PrdPromoArr(10,0)
pcv_retail=PrdPromoArr(11,0)
pcv_wholeSale=PrdPromoArr(12,0)

pcv_Filters=0
pcv_FResults=0
'Filter by Customers
pcv_CustFilter=0
query="select IDCustomer from PcPPFCusts where pcPrdPro_id=" & tmpIDCode
set rs=server.CreateObject("ADODB.RecordSet")
set rs=connTemp.execute(query)
if err.number<>0 then
call LogErrorToDatabase()
set rs=nothing
call closedb()
response.redirect "techErr.asp?err="&pcStrCustRefID
end if
if not rs.eof then
pcv_Filters=pcv_Filters+1
pcv_CustFilter=1
end if
set rs=nothing

if pcv_CustFilter=1 then

query="select IDCustomer from PcPPFCusts where pcPrdPro_id=" & tmpIDCode & " and IDCustomer=" & session("IDCustomer")
set rs=server.CreateObject("ADODB.RecordSet")
set rs=connTemp.execute(query)
if err.number<>0 then
call LogErrorToDatabase()
set rs=nothing
call closedb()
response.redirect "techErr.asp?err="&pcStrCustRefID
end if
if not rs.eof then
if (pcIncExcCust="0") then
pcv_FResults=pcv_FResults+1
end if
else
if (pcIncExcCust="1") then
pcv_FResults=pcv_FResults+1
end if
end if
set rs=nothing

end if
'End of Filter by Customers


'Filter by Customer Categories
pcv_CustCatFilter=0

query="select idCustomerCategory from pcPPFCustPriceCats where pcPrdPro_id=" & tmpIDCode
set rs=server.CreateObject("ADODB.RecordSet")
set rs=connTemp.execute(query)
if err.number<>0 then
call LogErrorToDatabase()
set rs=nothing
call closedb()
response.redirect "techErr.asp?err="&pcStrCustRefID
end if
if not rs.eof then
pcv_Filters=pcv_Filters+1
pcv_CustCatFilter=1
end if
set rs=nothing

if pcv_CustCatFilter=1 then

query="select pcPPFCustPriceCats.idCustomerCategory from pcPPFCustPriceCats, Customers where pcPPFCustPriceCats.pcPrdPro_id=" & tmpIDCode & " and pcPPFCustPriceCats.idCustomerCategory = Customers.idCustomerCategory and Customers.idcustomer=" & session("IDCustomer")
set rs=server.CreateObject("ADODB.RecordSet")
set rs=connTemp.execute(query)
if err.number<>0 then
call LogErrorToDatabase()
set rs=nothing
call closedb()
response.redirect "techErr.asp?err="&pcStrCustRefID
end if
if not rs.eof then
if (pcIncExcCPrice="0") then
pcv_FResults=pcv_FResults+1
end if
else
if (pcIncExcCPrice="1") then
pcv_FResults=pcv_FResults+1
end if
end if
set rs=nothing

end if
'End of Filter by Customer Categories

' Check to see if promotion is filtered by reatil or wholesale.
if (pcv_retail ="0" and pcv_wholeSale ="1") or (pcv_retail ="1" and pcv_wholeSale ="0") Then
pcv_Filters=pcv_Filters+1
if pcv_wholeSale = "1" and session("customertype") = 1 then
pcv_FResults=pcv_FResults+1
end if
if pcv_retail = "1" and session("customertype") <> 1 Then
pcv_FResults=pcv_FResults+1
end if
end if

if (pcv_Filters=pcv_FResults) AND PrdPromoArr(6,0)<>"" then%>
<div class="pcPromoMessage">
<%=PrdPromoArr(6,0)%>
</div>
<%end if
end if
set rsQ=nothing
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Product Promotion
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%>

Old Pedant
08-25-2010, 08:04 AM
I know you don't understand coding, but here's the problem: What you keep showing us are *SUBROUTINES*.

See the words such as
Public Sub pcs_ProductPromotionMsg
...
End Sub


So with ASP pages, any code that is in a SUB (or in a Function) can be located *ANYWHERE* on the page! Because it is *NOT* executed as it is found.

Instead, you have to look for where these SUBs are *called* from.

In other words, someplace *ELSE* on the page you will see code such as [code]
<%
...
Call pcs_ProductPromotionMsg
...
%>
And *THAT* is the code that matters. That's the code that is "positioning" the elements on the page.

TO make it more confusing, the word "Call" is optional. Just using the name of a Sub is enough to invoke it at the place it is used.

I'm sorry I didn't tumble to the fact that all you have been showing us so far are the Sub bodies. While the HTML they generate is important to your page, the *positioning* of that HTML is controlled by where they are invoked from.

And *that* is what you are going to have to find, someplace on the page.

Once you figure out where those SUBs are being invoked from, it's likely to be as easy as just changing the order they are invoked.

Old Pedant
08-25-2010, 08:07 AM
And I know you didn't write the code. I just find it unfortunate that your company chose such an antiquated and poorly written product for such an important part of your web business. It must be at least 8 or 10 years old, judging by the HTML it produces and the wasteful ways in which it is coded. And I'd bet it was written "on spec" by a bunch of pretty amateurish coders, likely some contract company offshore who bid to do a job cheaply, and too cheaply at that.