Home | Advertising Info5 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Saturday, April 27, 2024  

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - General
 PowerASP Code Help Area : Classic ASP - General
Subject Topic: redirect page Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
tashhen
Newbie
Newbie


Joined: May/07/2007
Online Status: Offline
Posts: 1
Posted: May/07/2007 at 7:20pm | IP Logged Quote tashhen

Hi

 

I am doing a chopping cart and i have a response page that is in vbscript that is sent to me from the secure server that verify's the CC details.  I want to add a confirmation email and store cart details in the DB which is in access ( this coding is in javascript).  When i do this the response page doesn't work, and it works without the store cart details in  db.  There is somthing conflicting between the two languages but i don't know what.  If i cant get all this on the same page i want to redirect the response page to a new page with confirmation email and store cart, if the transaction is ok.  Does anyone know how i get it all on the one page or redirect to a new page if transaction is ok.   Coding for all in page is below.Any help is greatly appreciated.

Natasha

 

<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="WA_eCart/WA_eCart_Definition_JS.asp" -->
<!--#include file="WA_eCart/isportCart_JS.asp" -->
<!--#include file="WA_eCart/WA_eCart_Database_JS.asp" -->
<!--#include file="Connections/connisport.asp" -->
<%
var rsUsers__MMColParam = "1";
if (String(Request.QueryString("UserID")) != "undefined" &&
    String(Request.QueryString("UserID")) != "") {
  rsUsers__MMColParam = String(Request.QueryString("UserID"));
}
%>
<%
var rsUsers = Server.CreateObject("ADODB.Recordset");
rsUsers.ActiveConnection = MM_connisport_STRING;
rsUsers.Source = "SELECT * FROM Users WHERE UserID = "+ rsUsers__MMColParam.replace(/'/g, "''") + "";
rsUsers.CursorType = 0;
rsUsers.CursorLocation = 2;
rsUsers.LockType = 1;
rsUsers.Open();
var rsUsers_numRows = 0;
%>
<!--#include file="WA_Universal_Email/AspMail_JS.asp" -->
<!--#include file="WA_Universal_Email/MailFormatting_JS.asp" -->
<%
function WA_Universal_Email_1_SendMail(RecipientEmail)  &nb sp;   {
  var MailAttachments = "";
  var MailBCC         = "";
  var MailCC          = "";
  var MailTo          = "";
  var MailBodyFormat  = "";
  var MailBody        = "";
  var MailImportance  = "";
  var MailFrom        = "nmcdonald73@eircom.net";
  var MailSubject     = "Order Confirmation";

  //Global Variables
  gBodyFormat = "";

  WA_MailObject = WAUE_Definition("www.isport.ie");

  if (RecipientEmail)     {
    WA_MailObject = WAUE_AddRecipient(WA_MailObject,RecipientEmail);
  }
  else      {
    //To Entries
  }

  //Attachment Entries
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String((rsUsers.Fields.Item("Name").Value)) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String((rsUsers.Fields.Item("Address").Value)) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String((rsUsers.Fields.Item("Address1").Value)) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String((rsUsers.Fields.Item("City").Value)) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String((rsUsers.Fields.Item("County").Value)) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String((rsUsers.Fields.Item("Country").Value)) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String((rsUsers.Fields.Item("PhoneNo").Value)) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String(isportCart.DisplayInfo("ProdID")) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String(isportCart.DisplayInfo("Name")) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String(isportCart.DisplayInfo("Description")) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String(isportCart.DisplayInfo("Quantity")) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String(isportCart.DisplayInfo("Price")) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String(isportCart.DisplayInfo("Size")) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String(isportCart.DisplayInfo("Colour")) + "");
  WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" + String(isportCart.GrandTotal()) + "");

  //BCC Entries

  //CC Entries
  WA_MailObject = WAUE_AddCC(WA_MailObject,"enquiries@acornsolutions.ie");

  //Body Format
  WA_MailObject = WAUE_BodyFormat(WA_MailObject,1);
  MailBodyFormat = gBodyFormat;

  //Set Importance
  WA_MailObject = WAUE_SetImportance(WA_MailObject,"1");

  //Start Mail Body
MailBody = MailBody + "Thank you for your order";
  //End Mail Body

  WA_MailObject = WAUE_SendMail(WA_MailObject,MailAttachments,MailBCC,MailCC,M ailTo,MailImportance,MailFrom,MailSubject,MailBody);

  WA_MailObject = null;
}
%>
<%// WA eCart Store Cart Summary in Db
if (""="")  {
  var WA_connection = MM_connisport_STRING;
  var WA_table = "Orders";
  var WA_redirectURL = "";
  var WA_indexField = "OrderID";
  var WA_fieldNamesStr = "OrderReferenceID|OrderUserID|OrderTotal";
  var WA_fieldValuesStr = "" + String(Session.SessionID) + "" + "|" + "" + String((rsUsers.Fields.Item("UserID").Value)) + "" + "|" + "" + String(isportCart.GrandTotal()) + "";
  var WA_columnTypesStr = "none,none,NULL|none,none,NULL|none,none,NULL";
  var WA_sessionName = "OrderNumber";
  var indexFieldIndex = -1;
  var WA_fieldValues = WA_fieldValuesStr.split("|");
  var WA_fieldNames = WA_fieldNamesStr.split("|");
  var WA_columns = WA_columnTypesStr.split("|");
  var WA_editCmd = Server.CreateObject('ADODB.Command');
  var updateFieldValue = "";
  WA_editCmd.ActiveConnection = WA_connection;
  if (WA_redirectURL != "" && Request.QueryString && Request.QueryString.Count > 0)  {
    WA_redirectURL += ((WA_redirectURL.indexOf('?') == -1)?"?":"&") + Request.QueryString;
  }
  for (var i = 0; i < WA_fieldNames.length; i++)  {
    if (WA_indexField  == WA_fieldNames)  {
      indexFieldIndex = i;
      break;
    }
  }
  if (indexFieldIndex >= 0)  updateFieldValue = WA_fieldValues[indexFieldIndex];
  if (updateFieldValue == "")  updateFieldValue = String(Session(WA_sessionName));
  var updateColType = "none,none,NULL";
  if (indexFieldIndex >= 0)  {
     updateColType = WA_columns[indexFieldIndex];
  }
  if (updateFieldValue != "" && updateFieldValue != "undefined")  {
      var valueForWhere = WA_generateInsertParams(new Array(WA_indexField), new Array(updateColType), new Array(updateFieldValue));
      var sqlstr = "select " + WA_indexField + " from " + WA_table + " where " + WA_indexField + " = " + valueForWhere.WA_dbValues + " order by " + WA_indexField + " DESC";
      var WA_eCartRecordset = Server.CreateObject("ADODB.Recordset");
      WA_eCartRecordset.ActiveConnection = WA_connection;
      WA_eCartRecordset.Source = sqlstr;
      WA_eCartRecordset.CursorType = 0;
      WA_eCartRecordset.CursorLocation = 2;
      WA_eCartRecordset.LockType = 1;
      WA_eCartRecordset.Open();
   if (!WA_eCartRecordset.EOF)
        updateFieldValue = String(WA_eCartRecordset.Fields.Item(WA_indexField).Value);
   else
     updateFieldValue = "";
   WA_eCartRecordset.Close();
  }
  if (updateFieldValue != "" && updateFieldValue != "undefined")  {
    var updateParamsObj = WA_generateInsertParams(WA_fieldNames, WA_columns, WA_fieldValues, indexFieldIndex);
   var valueForWhere = WA_generateInsertParams(new Array(WA_indexField), new Array(updateColType), new Array(updateFieldValue));
   WA_editCmd.CommandText = "update " + WA_table + " SET " + updateParamsObj.WA_setValues + " where " + WA_indexField + " = " + valueForWhere.WA_dbValues;
    WA_editCmd.Execute();
   WA_editCmd.ActiveConnection.Close();
  }
  else  {
    updateFieldValue = "";
    var insertParamsObj = WA_generateInsertParams(WA_fieldNames, WA_columns, WA_fieldValues);
    WA_editCmd.CommandText = "insert into " + WA_table + " (" + insertParamsObj.WA_tableValues + ") values (" + insertParamsObj.WA_dbValues + ")";
    WA_editCmd.Execute();
    WA_editCmd.ActiveConnection.Close();
  }
  if (indexFieldIndex < 0)  {
 if (updateFieldValue == "")  {
      var obj = WA_generateWhereClause(WA_fieldNames, WA_columns, WA_fieldValues, indexFieldIndex);
      var sqlstr = "select " + WA_indexField + " from " + WA_table + " where " +  obj.sqlWhereClause + " order by " + WA_indexField + " DESC";
      var WA_eCartRecordset = Server.CreateObject("ADODB.Recordset");
      WA_eCartRecordset.ActiveConnection = WA_connection;
      WA_eCartRecordset.Source = sqlstr;
      WA_eCartRecordset.CursorType = 0;
      WA_eCartRecordset.CursorLocation = 2;
      WA_eCartRecordset.LockType = 1;
      WA_eCartRecordset.Open();
   if (!WA_eCartRecordset.EOF)
        Session(WA_sessionName) = WA_eCartRecordset.Fields.Item(WA_indexField).Value;
   WA_eCartRecordset.Close();
 }
 else  {
   Session(WA_sessionName) = updateFieldValue;
 }
  }
  else  {
    Session(WA_sessionName) = WA_fieldValues[indexFieldIndex];
  }
  if (WA_redirectURL != "")  {
    Response.Redirect(WA_redirectURL);
  }
}
%>
<%
if (""="")     {
  //WA Universal Email object="AspMail"
  //Send Loop Once Per Entry
  WA_Universal_Email_1_SendMail("nmcdonald@acornsolutions.ie");
  WA_Universal_Email_1_SendMail("" + String((rsUsers.Fields.Item("UserEmail").Value)) + "");

  //Send Mail All Entries
  if (""!="")     {
    Response.Redirect("");
  }
}
%>
<%// WA eCart Store Cart Details in Db
if (""="")  {
  var WA_connection = MM_connisport_STRING;
  var WA_table = "OrderDetails";
  var WA_redirectURL = "";
  var WA_indexField = "DetailColour";
  var WA_fieldNamesStr = "DetailOrderID|DetailProductID|DetailProductName|DetailProdu ctDesc|DetailQuantity|DetailPrice|DetailColour|DetailSize";
  var WA_fieldValuesStr = "" + String(isportCart.DisplayInfo("ID")) + "" + "|" + "" + String(isportCart.DisplayInfo("ProdID")) + "" + "|" + "" + String(isportCart.DisplayInfo("Name")) + "" + "|" + "" + String(isportCart.DisplayInfo("Description")) + "" + "|" + "" + String(isportCart.DisplayInfo("Quantity")) + "" + "|" + "" + String(isportCart.DisplayInfo("Price")) + "" + "|" + "" + String(isportCart.DisplayInfo("Colour")) + "" + "|" + "" + String(isportCart.DisplayInfo("Size")) + "";
  var WA_columnTypesStr = "none,none,NULL|none,none,NULL|',none,''|',none,''|none,none ,NULL|none,none,NULL|',none,''|',none,''";
  var indexFieldIndex = -1;
  var WA_fieldValues = WA_fieldValuesStr.split("|");
  var WA_editCmd = Server.CreateObject('ADODB.Command');
  var WA_fieldNames = WA_fieldNamesStr.split("|");
  var WA_columns = WA_columnTypesStr.split("|");
  WA_editCmd.ActiveConnection = WA_connection;
  if (WA_redirectURL && Request.QueryString && Request.QueryString.Count > 0) {
    WA_redirectURL += ((WA_redirectURL.indexOf('?') == -1)?"?":"&") + Request.QueryString;
  }
  for (var i = 0; i < WA_fieldNames.length; i++)  {
    if (WA_indexField  == WA_fieldNames)  {
      indexFieldIndex = i;
      break;
    }
  }
  var deleteFieldValue = String(WA_fieldValues[indexFieldIndex]);
  if (deleteFieldValue != "" && deleteFieldValue != "undefined")  {
    var deleteParamsObj = WA_generateInsertParams(new Array(WA_indexField), new Array(WA_columns[indexFieldIndex]), new Array(deleteFieldValue));
    WA_editCmd.CommandText = "Delete from " + WA_table + " where " + WA_indexField + " = " + deleteParamsObj.WA_dbValues;
    WA_editCmd.Execute();
  }
  isportCart.MoveFirst();
  while (!isportCart.EOF())  {
    WA_fieldValuesStr = "" + String(isportCart.DisplayInfo("ID")) + "" + "|" + "" + String(isportCart.DisplayInfo("ProdID")) + "" + "|" + "" + String(isportCart.DisplayInfo("Name")) + "" + "|" + "" + String(isportCart.DisplayInfo("Description")) + "" + "|" + "" + String(isportCart.DisplayInfo("Quantity")) + "" + "|" + "" + String(isportCart.DisplayInfo("Price")) + "" + "|" + "" + String(isportCart.DisplayInfo("Colour")) + "" + "|" + "" + String(isportCart.DisplayInfo("Size")) + "";
    WA_fieldValues = WA_fieldValuesStr.split("|");
    var insertParamsObj = WA_generateInsertParams(WA_fieldNames, WA_columns, WA_fieldValues);
    WA_editCmd.CommandText = "insert into " + WA_table + " (" + insertParamsObj.WA_tableValues + ") values (" + insertParamsObj.WA_dbValues + ")";
    WA_editCmd.Execute();
    isportCart.MoveNext();
  }
  isportCart.MoveFirst();
  WA_editCmd.ActiveConnection.Close();
  if (WA_redirectURL != "")  {
    Response.Redirect(WA_redirectURL);
  }
}
%>
<%
// WA eCart Redirect
if (isportCart_redirStr != "")     {
  Response.Redirect(isportCart_redirStr);
}
%>

<%
rsUsers.Close();
%>

<%
rsUsers.Close();
%>

Back to Top View tashhen's Profile Search for other posts by tashhen
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages asp source code database MS SQL MS Access .mdb adovbs.inc cookies calendar codes sql commands scripts asp programming tutorials iis web server components CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com