Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making this array run more than once in a page

Status
Not open for further replies.

ladybugz46

Technical User
Sep 26, 2002
7
0
0
US
Hi, I am back with this vbscript pricing array I have developed. It works great on an item details page, that is, on a single item page. It now needs to work on a page of search results with multiple items.

The way I have it configured it runs the array once and then gives me a runtime error type mismatch at the line where the array is dim-ed.

It needs to run every time an item is placed on the page.

I have tried a do until loop that uses the total amount of items in the cart and it won't load the page.

Any ideas would be welcome......would love to look at code you are willing to share where something similar has been done.

Thanks in advance!!! suez code is below

array and code (in a file include)
there is a chunk pulled out of the middle of it just for simplicity's sake.

<%Dim sku
sku = Cstr(itmno)

Dim outletPrice(259,2)


outletPrice(251,0) = &quot;511673GF&quot;
outletPrice(251,1) = &quot;28.34&quot;
outletPrice(252,0) = &quot;511682GF&quot;
outletPrice(252,1) = &quot;15.36&quot;
outletPrice(253,0) = &quot;511681GF&quot;
outletPrice(253,1) = &quot;10.97&quot;
outletPrice(254,0) = &quot;511680GF&quot;
outletPrice(254,1) = &quot;11.64&quot;
outletPrice(255,0) = &quot;511684GF&quot;
outletPrice(255,1) = &quot;9.93&quot;
outletPrice(256,0) = &quot;511685GF&quot;
outletPrice(256,1) = &quot;16.5&quot;
outletPrice(257,0) = &quot;511689GF&quot;
outletPrice(257,1) = &quot;17.55&quot;
outletPrice(258,0) = &quot;511384GF&quot;
outletPrice(258,1) = &quot;12.7&quot;
outletPrice(259,0) = &quot;511690GF&quot;
outletPrice(259,1) = &quot;11.31&quot;

'origPrice is what is uploaded to macs
'outletPrice is what is in the array (given to us by merchandising)

Dim origPrice
origPrice = itmpri
For i = LBound(outletPrice) to UBound(outletPrice)
Dim savings
savings = origPrice / outletPrice(i,1)

if outletPrice(i,0) = sku Then

response.write(&quot;<font size=1 color=#ff0000><B>SAVE  &quot; & FormatPercent(savings,0) & &quot;  </B></font><br>&quot;)
response.write(&quot;<font face=Arial,Verdana,helvetica size=1 color=#999999><b>Regular Price: &quot; & FormatCurrency(outletPrice(i,1)) & &quot;</b></font><br>&quot;)
response.write(&quot;<font face=Arial,Verdana,helvetica size=1 color=#000099><b>NOW ONLY:</b></font>  <font size=1 color=#ff0000><b>&quot; & FormatCurrency(origPrice) & &quot;</font></b><BR>&quot;)

else
End if
next
%>


the following is the page code:

<table width=&quot;570&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; bgcolor=&quot;#FFFFFF&quot;>
<TR bgcolor=&quot;FFFFFF&quot;><td>
<%
DIM itmedp
dim itmno
dim itmdesc
dim itmprc
dim itminv
dim itmavl
dim itmpri
dim itmvar
dim imgovr

For icount = 1 to pgln

itmedp = trim(trans03.GetValue(&quot;ItemEdp&quot;,cint(icount)))
itmno = trim(trans03.GetValue(&quot;ItemNo&quot;,cint(icount)))
itmdesc = trans03.GetValue(&quot;ItemDescription&quot;,cint(icount))
itmpri = trans03.GetValue(&quot;ItemPrice&quot;,cint(icount))
itminv = trim(trans03.GetValue(&quot;ItmAvailableInv&quot;,cint(icount)))
itmvar = trans03.GetValue(&quot;ItemIdVar&quot;,cint(icount))
imgovr = trim(trans03.GetValue(&quot;ItmImageOvrd&quot;,cint(icount)))
if itmedp = &quot;&quot; then exit for

if itminv > &quot;0&quot; then itmavl = &quot;IN STOCK&quot; else itmavl = &quot;Out of Stock&quot;
'if itmpri = ** then itmprc = &quot;Select For Price&quot; else itmprc = itmpri


if len(trim(imgovr)) = 0 then
imgovr = itmedp
end if

thePath = &quot;images\&quot; & imgovr & &quot;.jpg&quot;

Set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
If (fs.FileExists(Server.Mappath(thePath)))=false Then
thePic = &quot;images\default.jpg&quot;
else
thePic = &quot;images\&quot; & imgovr & &quot;.jpg&quot;
end if
Set fs=nothing
%>

<table width=&quot;100%&quot; align=&quot;center&quot; border=&quot;0&quot; bgcolor=&quot;#ffffff&quot;><tr bgcolor=&quot;#ffffff&quot;>
<!-- Image Display -->
<td align=&quot;left&quot; valign=&quot;top&quot; width=&quot;100&quot;>
<A href=&quot;details_os.asp?PN=<% =itmno %>&UID=<% =cuid %>&UPS1=1&GEN1=<% Response.Write(Gen1Str) %>&quot;><img SRC=&quot;<% =thepic %>&quot; border=&quot;0&quot;></a>
</td>
<!-- Description Display -->
<td align=&quot;left&quot; valign=&quot;top&quot; width=&quot;253&quot;><font face=&quot;arial, helvetica, san-serif&quot; size=&quot;-2&quot; color=&quot;#000066&quot;>Item Description</font><br>
<A href=&quot;details_os.asp?PN=<% =itmno %>&UID=<% =cuid %>&UPS1=1&GEN1=<% Response.Write(Gen1Str) %>&quot;><font size=1 face=&quot;arial, helvetica, san-serif&quot;><% =itmdesc %></font></A><br><font face=&quot;arial, helvetica, san-serif&quot; size=&quot;-2&quot; color=&quot;#000066&quot;>Order #</font> <font face=&quot;arial, helvetica, san-serif&quot; size=1><b><% =itmno %></b></font><br><font face=&quot;arial, helvetica, san-serif&quot; size=1 color=&quot;#000066&quot;>- <% =itmavl %> -</font></td>
<!-- Item Price Display -->
<%<td align=&quot;center&quot; valign=&quot;top&quot; width=&quot;230&quot;>
<!-- loop for multi-pricing -->
<table width=&quot;100%&quot; border=&quot;0&quot;>
<tr>
<TD>

<!--#INCLUDE FILE = &quot;jscript/outlet_array_os.asp&quot; -->
</td>
</tr>
</table>
<!-- end loop for multi-pricing -->




many many thanks!! suez

should be able to view the error here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top