close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Unknown Column on Confirm.php, fixes elsewhere in forum aren't working

Thread began 11/09/2011 7:59 am by Justin@AdventDesign | Last modified 11/09/2011 12:03 pm by Jason Byrnes | 1206 views | 5 replies |

Justin@AdventDesign

Unknown Column on Confirm.php, fixes elsewhere in forum aren't working

When attempting to checkout from the confirm.php page, I get the following error:

Unknown column 'M00122' in 'field list'

The order is inserted into the 'orders' table properly, but nothing shows up in the orderdetails table.

I've found similar events in numerous posts throughout this forum.

'M00122' is the part number of the product in the cart, so first I changed the DetailProductID in the orderdetails table to varchar rather than INT, which appears to be the fix for most. Still get the same error after this change. Dumped cache and sessions and tried a new browser, same error.

As suggested in another thread, on the confirm.php code I changed:

$WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());

to:

$WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error()."<br />".$WA_sql);

Then, rerunning the pages, I get:

Notice: Undefined variable: WA_sql in /Applications/XAMPP/xamppfiles/htdocs/beta/00_Aveo/confirm.php on line 292

Notice: Undefined variable: WA_sql in /Applications/XAMPP/xamppfiles/htdocs/beta/00_Aveo/confirm.php on line 292
Query was empty

I also tried modifying the ecart Object column for ID from number to text, thinking maybe that was the problem. Didn't work so I changed it back.

You can access and test the pages yourself at products/

I've attached the confirm.php page if that helps.

Attached Files
confirm.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

is M00122 the product ID stored in the ID column of the cart?

if so, then you need to change the data type for the DetailProductID column of the details table to varchar, and edit the Store order details behavior to pass that column as text.

Sign in to reply to this post

Justin@AdventDesign

As mentioned above, I already fixed the DetailProductID with varchar. Can you give me a little more of a hint, is it off the confirm.php page I'd find the "Store order details" behavior? I'm not seeing it.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, the eCart Store Order Details behavior is on the confirm page.

just changing the column in the database will not fix the problem.

you need to edit the eCart Store Order details server behavior to change the data type being used to pass the value to the database.

Sign in to reply to this post

Justin@AdventDesign

I believe this is the section of code I'm looking for, but there is nothing in the "Server Behaviors" pallet that sounds like anything remotely like that. Is that what I'm looking for?

<?php
// WA eCart Store Cart Details in Db
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) // Trigger
{
$WA_connection = $adventcms;
$WA_table = "orderdetails";
$WA_redirectURL = "checkout_success.php";
$WA_indexField = "DetailOrderID";
$WA_fieldNamesStr = "DetailOrderID|DetailProductID|DetailName|DetailPrice|DetailQuantity";
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".((isset($_SESSION["eCart1_OrderID"]))?$_SESSION["eCart1_OrderID"]:"") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("ID") ."") . "|" . "".$eCart1->DisplayInfo("Name") ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Price") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Quantity") ."");
$WA_columnTypesStr = "none,none,NULL|none,none,NULL|',none,''|none,none,NULL|none,none,NULL";
$WA_sql = "";
mysql_select_db($database_adventcms, $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()."<br />".$WA_sql);
$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") ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Price") ."") . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("Quantity") ."");
$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()."<br />".$WA_sql);
$eCart1->MoveNext();
}
if ($WA_redirectURL != "") {
header("Location: ".$WA_redirectURL); exit;
}
$eCart1->MoveFirst();
}
?>

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

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