close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Error message on confirm page when integrating Sagepay

Thread began 10/12/2009 6:32 am by blu | Last modified 10/16/2009 4:56 pm by blu | 2621 views | 5 replies

blu

OK, not sure how that happened as I just followed the wizard and ecart generated the tables. Perhaps I just selected the wrong field when going through the wizard (the help system isn't as helpful as it could be as it seems to be only for ASP users and I'm PHP).

Anyway, code below for the confirm.php page if anyone can have a look to see if there's any obvious mis-assignment. I've set up both order summary and order details storing as you can probably see.

Wish I could just enter the wizard again and show how I've assigned them in windows, but it seems like a one-time deal and I can't find a way to bring those windows up again (please let me know if there's a way to do this - I can't find anything in the help system).

Code:

<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php require_once('Connections/hab.php'); ?>
<?php
$eCart1->GetContent();
?>
<?php
//WA eCart Include
require_once("WA_eCart/WA_eCart_Database_PHP.php");
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["eCartCheckoutForm_state_province"] = "".((isset($_POST["state_province"]))?$_POST["state_province"]:"") ."";
}
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["eCartCheckoutForm_country"] = "".((isset($_POST["country"]))?$_POST["country"]:"") ."";
}
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["eCartCheckoutForm_shipping_state_province"] = "".((isset($_POST["shipping_state_province"]))?$_POST["shipping_state_province"]:"") ."";
}
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["eCartCheckoutForm_shipping_country"] = "".((isset($_POST["shipping_country"]))?$_POST["shipping_country"]:"") ."";
}
?>
<?php
// WA eCart Store Cart Summary in Db
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $hab;
$WA_table = "shop_order_summary";
$WA_redirectURL = "";
$WA_indexField = "orderuserid";
$WA_fieldNamesStr = "ofderreferenceid|ordershipping|ordertax|ordersubtotal|ordertotal|orderstatus|billingname|billingaddress|billingphone|billingemail|shippingname|shippingaddress|shippingphone|shippingemail";
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".session_id() ."") . "|" . "".$eCart1->GetShipping() ."" . "|" . "".$eCart1->GetTax() ."" . "|" . "".$eCart1->GetTaxableTotal() ."" . "|" . "".$eCart1->GrandTotal() ."" . "|" . "placed" . "|" . "".((isset($_POST["lastname"]))?$_POST["lastname"]:"") ."" . "|" . "".((isset($_POST["street1"]))?$_POST["street1"]:"") ."" . "|" . "".((isset($_POST["phone"]))?$_POST["phone"]:"") ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" . "".((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:"") ."" . "|" . "".((isset($_POST["shipping_street1"]))?$_POST["shipping_street1"]:"") ."" . "|" . "".((isset($_POST["shipping_phone"]))?$_POST["shipping_phone"]:"") ."" . "|" . "".((isset($_POST["shipping_email"]))?$_POST["shipping_email"]:"") ."";
$WA_columnTypesStr = "none,none,NULL|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_sessionName = "eCart1_OrderID";
$WA_Sql = "";
$NeedInsert = false;
$indexFieldIndex = -1;
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_hab;
$updateFieldValue = "";
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
if ($WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos('?', $WA_redirectURL) === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
for ($i = 0; $i < sizeof($WA_fieldNames); $i++)
{
if ($WA_indexField == $WA_fieldNames[$i])
{
$indexFieldIndex = $i;
break;
}
}
$deleteFieldValue = "";
$updateColType = "none,none,NULL";
if ($indexFieldIndex >= 0) $updateFieldValue = $WA_fieldValues[$indexFieldIndex];
if ($updateFieldValue == "" && isset($_SESSION[$WA_sessionName])) $updateFieldValue = $_SESSION[$WA_sessionName];
if ($indexFieldIndex >= 0) $updateColType = $WA_columns[$indexFieldIndex];
if ($updateFieldValue != "") {
$updateParamsObj = WA_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, $indexFieldIndex);
$valueForWhere = WA_generateInsertParams(array($WA_indexField), array($updateColType), array($updateFieldValue), -1);
$WA_Sql = "update " . $WA_table . " SET " . $updateParamsObj->WA_setValues . " where " . $WA_indexField . " = " . $valueForWhere->WA_dbValues;
$WA_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = $updateFieldValue;
$result = mysql_query("SELECT * FROM " . $WA_table . " where " . $WA_indexField . " = " . $valueForWhere->WA_dbValues, $WA_connection);
$num_rows = mysql_num_rows($result);
$NeedInsert = (mysql_num_rows($result) === 0);
}
if ($updateFieldValue === "" || $NeedInsert) {
$updateFieldValue = "";
$insertParamsObj = WA_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "insert into " . $WA_table . " (" . $insertParamsObj->WA_tableValues . ") values (" . $insertParamsObj->WA_dbValues . ")";
$WA_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
}
if ($WA_redirectURL != "") {
header("Location: ".$WA_redirectURL); exit;
}
}
?>
<?php
// WA eCart Store Cart Details in Db
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $hab;
$WA_table = "shop_order_details";
$WA_redirectURL = "";
$WA_indexField = "orderdetailsid";
$WA_fieldNamesStr = "orderdetailsid|productid|productname|productdescription|quantity|price";
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".((isset($_SESSION["eCart1_OrderID"]))?$_SESSION["eCart1_OrderID"]:"") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("ID") ."") . "|" . "".$eCart1->DisplayInfo("Name") ."" . "|" . "".$eCart1->DisplayInfo("Description") ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Quantity") ."") . "|" . "".$eCart1->DisplayInfo("Price") ."";
$WA_columnTypesStr = "none,none,NULL|none,none,NULL|',none,''|',none,''|none,none,NULL|',none,''";
$WA_sql = "";
mysql_select_db($database_hab, $WA_connection);
$indexFieldIndex = -1;
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
if (!session_id()) session_start();
if ($WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos('?', $WA_redirectURL) === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
for ($i = 0; $i < sizeof($WA_fieldNames); $i++)
{
if ($WA_indexField == $WA_fieldNames[$i])
{
$indexFieldIndex = $i;
break;
}
}
$deleteFieldValue = $WA_fieldValues[$indexFieldIndex];
if (isset($deleteFieldValue) && $deleteFieldValue != "")
{
$deleteParamsObj = WA_generateInsertParams(array($WA_indexField), array($WA_columns[$indexFieldIndex]), array($deleteFieldValue), -1);
$WA_sql = "Delete from " . $WA_table . " where " . $WA_indexField . " = " . $deleteParamsObj->WA_dbValues;
$WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());
$WA_okToDelete = false;
}
$eCart1->MoveFirst();
while (!$eCart1->EOF())
{
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".((isset($_SESSION["eCart1_OrderID"]))?$_SESSION["eCart1_OrderID"]:"") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("ID") ."") . "|" . "".$eCart1->DisplayInfo("Name") ."" . "|" . "".$eCart1->DisplayInfo("Description") ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Quantity") ."") . "|" . "".$eCart1->DisplayInfo("Price") ."";
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$insertParamsObj = WA_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_sql = "insert into ".$WA_table." (".$insertParamsObj->WA_tableValues.") values (".$insertParamsObj->WA_dbValues.")";
$WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());
$eCart1->MoveNext();
}
if ($WA_redirectURL != "") {
header("Location: ".$WA_redirectURL); exit;
}
$eCart1->MoveFirst();
}
?>
<?php
if ($eCart1->IsEmpty()) {
$eCart1->redirStr = "ecart.php";
$eCart1->cartAction = "RedirectIfEmpty";
}
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?><?php
require_once("WA_eCart/checkoutScripts/Protx_VSPForm.php");
?>






thanks in advance
Bruce

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...