Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 6th, 2008, 06:39 AM
Registered User
 
Join Date: Mar 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Shopping cart bug.

Hi

I have a little problem with shopping cart which are written in classic asp.

I cannot seem to fix the bug where worldpay cannot accept the amount when it will submit the process. obivously there is something wrong with it.

In my knowledge in classic asp, for example like this,

file1.asp
<form>
if sCost = 0 then
<input type="hidden" name="amount" value="<%=netamount%>"/>
else
<input type="hidden" name="amount" value="<%=nett%>"/>
<form/>

file2.asp
<script>
dcost = request("deliverycost")
if dcost = 0 then
test = request.form("amount")
amount = test2
else
test1 = request.form("nett")
amount = test1
end if
<script>

The problem is that worldpay cannot accept the amount when dcost is more than 0. it show some error, saying currency or amount is not correct.

but it show correct amount when dcos is equal to 0, worldpay accept and process.

I had tried using different combination but none worked.
I am totally stuck there.

Here the partial code.

checkoutconfirm.asp
<script type="text/javascript">
function check(browser)
  {

  document.getElementById("nett").value=browser;
  a = document.getElementById("nett").value=browser;
  }


  function invalid() {
    if (document.BuyForm.nett.value =="") {
        alert("Delivery option is blank. Please select option1 or option2");
        document.BuyForm.nett.focus();
        return false;
        }
     }
</script>

"code here go on until body tag"

<form action="checkoutprocess.asp" method="post" name="BuyForm" onSubmit='return invalid();'>

                        <%if check=2 or check=4 then %>


                              S<%= cursymbol & formatnumber(netamount) %><br />


                              <%else %>
                                 S$<input type="text"name="nett" id="nett" size="8"readonly="true" />


                                  <%end if%>
                              </span>
                              </td>

                            </tr>
                            <tr>
                              <td colspan="4">&nbsp;</td>
                            </tr>
                          </table>



                            <input type="hidden" name="deliverycost" value="<%=sCost%>" />
                               <input type="hidden" name="subtotal" value="<%=subtotal%>" />


                            <%if sCost = 0 then %>
                            <input type="hidden" name="amount" value="<%=netamount%>" />
                            <%else%>
                            <input type="hidden" name="amount" value="<%=nett%>" />
                            <%end if%>

After that, i will submit information to checkoutprocess.asp to proceed the worldpay.

"checkoutprocess.asp"
<%@LANGUAGE="VBSCRIPT"%>


<%
    If IsArray(Session("cart")) = false Then
        response.redirect("ViewCart.asp")
    End If

    acart = Session("cart")
    cempty = true

    For i=lbound(acart) to ubound(acart)
        If acart(i,0)<>"" and acart(i,1)<>"" Then
            cempty=false
        End If
    Next

    If cempty Then
        response.redirect("ViewCart.asp")
    End If

    strstatus = "a"

    dcost = request("deliverycost")

    if dcost = 0 then

    test=request.Form("amount")
    subt = request("subtotal")
    amount = test
    dcost = test - subt

    else

    test2=request.Form("nett")
    subt = request("subtotal")
    amount = test2
    dcost = test2 - subt

         end if

         'code go on here until u see body tag.

<body onLoad="redirectsumit();">
<FORM action="https://select.worldpay.com/wcc/purchase" method="post" name="BuyForm">
                                <INPUT name=instId type=hidden value="139979"> <%
                                desc = "Order No : " & orderid
                                cartID = desc & " " & now()
                                %>

                                <INPUT name="cartId" type=hidden value="<%=cartID%>">
                                <INPUT name="desc" type=hidden value="<%=desc%>">
                                <INPUT name="testMode" type=hidden value="100">
                                <% fullname = Request("userFname") & " " & Request("userLname")
                                %>
                                <INPUT name="name" type=hidden value="<%= fullname %>">
                                <INPUT name="address" type=hidden value="<%= Request("userAddress") %>">
                                <INPUT name="country" type=hidden value="<%= sCountry %>">
                                <INPUT name="postcode" type=hidden value="<%= Request("userZip") %>">
                                <INPUT name="email" type=hidden value="<%= Request("useremail") %>">
                                <INPUT TYPE=HIDDEN NAME=currency VALUE="SGD">
                                <INPUT TYPE=HIDDEN NAME=amount VALUE="<%= amount%>">
</form>










Similar Threads
Thread Thread Starter Forum Replies Last Post
shopping cart keyvanjan Classic ASP Basics 1 January 9th, 2007 10:16 PM
Shopping Cart seannie ASP.NET 2.0 Basics 0 December 12th, 2006 10:28 AM
Shopping cart help rsm42 ASP.NET 1.0 and 1.1 Basics 3 December 9th, 2006 06:09 AM
Shopping Cart inkrajesh ASP.NET 1.0 and 1.1 Basics 2 February 28th, 2006 03:08 AM
shopping cart isheikh BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 October 8th, 2004 04:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.