close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Error message on confirm page when integrating Sagepay

Thread began 10/12/2009 9:32 am by blu | Last modified 10/16/2009 7:56 pm by Jason Byrnes | 1449 views | 5 replies |

blu

Error message on confirm page when integrating Sagepay

Hi there

I'm trying to link ecart to SagePay. I'm using version 4.5.2.

I've gone through the checkout wizard (using a made-up merchant number as I'm testing while awaiting the real number from my client since he's in a hurry) and when I test it afterwards I'm getting the following error message on a blank screen after I enter contact details into the checkout page and click over t the confirm.php page:

Unknown column 'lrp7c4pbdf6qtgnj6drofecia3' in 'field list'

Searching all site files for 'lrp7c4pbdf6qtgnj6drofecia3' turns up no results.

Please help. I'm stuck and can't find anything similar in the other forum threads.

Bruce

Sign in to reply to this post

Dani Chankhour

Whenever you receive "Unknown Column ..." type of errors, indicates that you are trying to store the wrong type in your table column. Most likely, you could be trying to store the session id in a table column with an integer type.

I would recommend looking over you table and make sure that you have the correct data type for each column and also make sure you are storing the correct information for that column.

Sign in to reply to this post

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

Sign in to reply to this post

blu

Oh, my bad. I think I created the tables manually rather than ecart creating them. SQL of the both of them below:

CREATE TABLE `shop_order_summary` (
`orderid` int(11) NOT NULL auto_increment,
`ofderreferenceid` int(11) default NULL,
`orderuserid` int(11) default NULL,
`ordershipping` varchar(24) default NULL,
`ordertax` varchar(24) default NULL,
`ordersubtotal` varchar(24) default NULL,
`ordertotal` varchar(24) default NULL,
`orderdate` date default NULL,
`orderstatus` varchar(80) default NULL,
`billingname` varchar(250) default NULL,
`billingaddress` varchar(250) default NULL,
`billingphone` varchar(40) default NULL,
`billingemail` varchar(250) default NULL,
`shippingname` varchar(250) default NULL,
`shippingaddress` varchar(250) default NULL,
`shippingphone` varchar(40) default NULL,
`shippingemail` varchar(250) default NULL,
PRIMARY KEY (`orderid`)
)

CREATE TABLE `shop_order_details` (
`orderdetailsid` int(12) NOT NULL auto_increment,
`orderid` int(12) NOT NULL default '0',
`productid` int(12) NOT NULL default '0',
`productname` varchar(250) NOT NULL default '',
`productdescription` varchar(250) default NULL,
`quantity` int(4) NOT NULL default '0',
`price` varchar(24) NOT NULL default '0.00',
PRIMARY KEY (`orderdetailsid`)
)



I'm running some tests to see if changing some of the field types fixes my problem



Bruce

Sign in to reply to this post

blu

OK, I've tried changing 'ofderreferenceid' into a varchar (80) to see if that helps as that's the field that holds the session id but I'm getting the same error

(I've corrected a typo and changed the name to 'orderreferenceid' as well updating both the confirm.php file and the database table - just for information)

Anyone got any ideas?

Sign in to reply to this post

Jason ByrnesWebAssist

The store cart summary server behavior is setting the data type for the orderreferanceid column to a numeric data type.

double click the store cart summary server behavior, select the orderreferanceid column and set the data type to text.

Sign in to reply to this post

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...