close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Column 'DetailOrderID' cannot be null -can you please help me find the issue?

Thread began 11/06/2014 4:36 am by john42771 | Last modified 11/06/2014 4:50 pm by john42771 | 509 views | 5 replies

john42771

Jason, I really appreciate your early reply this morning.

Sorry, but I don't understand what to do with this:
[you need to bind the Details OrderID column to the correct session, WA_Store_Cart_OrderID].
Please show me or direct me to more detailed instructions on binding to the correct session. I don't know how to do this - sorry.

Below are the 2 server behaviors: Summary ($WA_sessionName = "WA_Store_Cart_OrderID";) and Details ("".$_SESSION['OrderID'] .""):
<?php

// WA eCart Store Cart Summary in Db
if (isset($_POST["Payment_submit"]) || isset($_POST["Payment_submit_x"])) // Trigger
{
$WA_connection = $PowerStoreConnection;
$WA_table = "ps4_orders";
$WA_redirectURL = "";
$WA_indexField = "OrderID";
$WA_fieldNamesStr = "OrderAmount|OrderShipName|OrderShipAddress|OrderShipAddress2|OrderCity|OrderState|OrderZip|OrderCountry|OrderPhone|OrderShipping|OrderTax|OrderEmail|OrderDate";
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".$WA_Store_Cart->GrandTotal() ."") . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','First_Name_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','First_Name')))) ." ".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Last_Name_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Last_Name')))) ."" . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Address_1_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Address_1')))) ."" . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Address_2_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Address_2')))) ."" . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','City_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','City')))) ."" . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','State_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','State')))) ."" . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Postal_Code_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Postal_Code')))) ."" . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Country_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Country')))) ."" . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Phone_Number_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Phone_Number')))) ."" . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->GetShipping() ."") . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->GetTax() ."") . "|" . "".(WA_coalesce(array(WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Email_Address_2'),WA_getSavedFormValue('CheckoutWizard_NewFromBlank_Default','Email_Address')))) ."" . "|" . "".(date('Y-m-d h:i:s')) ."";
$WA_columnTypesStr = "none,none,NULL|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|none,none,NULL|none,none,NULL|',none,''|',none,''";
$WA_sessionName = "WA_Store_Cart_OrderID";
$WA_Sql = "";
$NeedInsert = false;
$indexFieldIndex = -1;
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_PowerStoreConnection;
$updateFieldValue = "";
mysql_select_db($WA_connectionDB, $WA_connection);
@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 (isset($_POST["Payment_submit"]) || isset($_POST["Payment_submit_x"])) // Trigger
{
$WA_connection = $PowerStoreConnection;
$WA_table = "ps4_orderdetails";
$WA_redirectURL = "";
$WA_indexField = "DetailOrderID";
$WA_fieldNamesStr = "DetailOrderID|DetailProductID|DetailName|DetailPrice|DetailSKU|DetailQuantity|DetailDiscount|DetailDigitalGood|DetailMaxDownloads|DetailCode";
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".$_SESSION['OrderID'] ."") . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->DisplayInfo("ID") ."") . "|" . "".$WA_Store_Cart->DisplayInfo("Name").((strlen($WA_Store_Cart->DisplayInfo("Options")) > 0)?'--'.$WA_Store_Cart->DisplayInfo("Options"):"") ."" . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->DisplayInfo("Price") ."") . "|" . "".$WA_Store_Cart->DisplayInfo("SKU") ."" . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->DisplayInfo("Quantity") ."") . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->TotalColumn("DiscountApplied") ."") . "|" . "".$WA_Store_Cart->DisplayInfo("DigitalGood") ."" . "|" . WA_eCDB_ConvertNumber("".($WA_Store_Cart->DisplayInfo("MaxDownloads")*$WA_Store_Cart->DisplayInfo("Quantity")) ."" . "|" . substr(str_shuffle('abcdefghijklmnopqurstuvwxyz1234567890'),0,8));
$WA_columnTypesStr = "none,none,NULL|none,none,NULL|',none,''|none,none,NULL|',none,''|none,none,NULL|none,none,NULL|',none,''|none,none,NULL|',none,''";
$WA_sql = "";
mysql_select_db($database_PowerStoreConnection, $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;
}
$WA_Store_Cart->MoveFirst();
while (!$WA_Store_Cart->EOF())
{
$WA_fieldValuesStr = WA_eCDB_ConvertNumber("".$_SESSION['OrderID'] ."") . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->DisplayInfo("ID") ."") . "|" . "".$WA_Store_Cart->DisplayInfo("Name").((strlen($WA_Store_Cart->DisplayInfo("Options")) > 0)?'--'.$WA_Store_Cart->DisplayInfo("Options"):"") ."" . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->DisplayInfo("Price") ."") . "|" . "".$WA_Store_Cart->DisplayInfo("SKU") ."" . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->DisplayInfo("Quantity") ."") . "|" . WA_eCDB_ConvertNumber("".$WA_Store_Cart->TotalColumn("DiscountApplied") ."") . "|" . "".$WA_Store_Cart->DisplayInfo("DigitalGood") ."" . "|" . WA_eCDB_ConvertNumber("".($WA_Store_Cart->DisplayInfo("MaxDownloads")*$WA_Store_Cart->DisplayInfo("Quantity")) ."" . "|" . substr(str_shuffle('abcdefghijklmnopqurstuvwxyz1234567890'),0,8));
$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());
$WA_Store_Cart->MoveNext();
}
if ($WA_redirectURL != "") {
header("Location: ".$WA_redirectURL); exit;
}
$WA_Store_Cart->MoveFirst();
}
?>

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