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

rating

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 Jason Byrnes | 512 views | 5 replies |

john42771

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

My changes have broken the correct submitting of information. Upon submission I get this "Column 'DetailOrderID' cannot be null".

I used eCart 6 to customize a PowerStore. My client no longer wanted their customers to need login credentials or access to a profile, orders, or the view download page. I used the eCart checkout wizard to set up the ajax checkout experience (one page) as well as removing the customer's need to access anything through a login. (FYI: Customer receives a link to the product in an email. They may be using the product themselves, or they may have purchased it for someone else. Once that link is clicked, THEN the user will need to register to get access to the online product.)

Don't know if this is related at all, but I'm also noticing 2 different submits in the code. Payment_submit and CheckoutWizard_submit.
Is one incorrect?
Here's one related to the database:
if ((isset($_POST["Payment_submit"]) || isset($_POST["Payment_submit_x"]))) {
Here's the other:
<input class="formButton" name="CheckoutWizard_submit" type="submit" id="CheckoutWizard_submit" value="Continue" onClick="clearAllServerErrors('CheckoutWizard_NewFromBlank_Default')" tabindex="12">

Additionally, the AJAX checkout experience on a PC is acting funky by submitting the first part of the form prematurely - before any "Continue" button was pressed. Perhaps things are conflicting - needs debugging.

Attached Files
checkout.php
checkout7.php
confirm7.php
confirm7_cart.php
Sign in to reply to this post

Jason ByrnesWebAssist

on the confirm page, in the store order details behavior, you have the DetailOrderId column bound to the OrderID session. but the session being created by the store order summary is named WA_Store_Cart_OrderID

you need to bind the Details OrderID column to the correct session, WA_Store_Cart_OrderID


the two form buttons are correct, the CheckoutWizard_submit button is the checkout form on the checkout page.

the Payment_submit button is the final submit button that processes the transaction on the confirm page.

to debug the AJAX issue, Ill need a link where i can see the problem and details on how to reproduce.

Sign in to reply to this post

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();
}
?>

Sign in to reply to this post

Jason ByrnesWebAssist

open the server behaviors panel

double click the Store Order details server behavior.

in the store order details server behavior, select the detail Order ID column and bind it to the WA_Store_Cart_OrderID session variable.

Sign in to reply to this post

john42771

Thank you. That removed the initial problem (Column 'DetailOrderID' cannot be null).
However...things are not all fine. Nothing works without this little bit.
Ray had written some code so that a DetailCode would be inserted in the ps4_orderdetails table.
With each order, a code is supposed to be generated and recorded. It was working before I switched out for the checkout wizard instead of PowerStore.
It's not being generated now. Could you please take a look? You should have the necessary pages, checkout7.php and confirm7.php

Upon purchase, the customer is sent a Product Access LINK like this:
<a href="http://www.lovetakeslearning.com/products/<?php echo $row_DigitalGoods['DetailDigitalGood']; ?>?key=<?php echo $row_DigitalGoods['DetailCode']; ?>">http://www.lovetakeslearning.com/products/<?php echo $row_DigitalGoods['DetailDigitalGood']; ?>?key=<?php echo $row_DigitalGoods['DetailCode']; ?></a>

I am also attaching the admin's order detail page. This page is meant to display the product access link as directly above.

Attached Files
orders_detail.php
Sign in to reply to this post

Jason ByrnesWebAssist

Any code Ray had implemented would have been specific to the existing power store checkout page.

I Would need to see the original checkout pages to be able to troubleshoot. really, where you have red=one the checkout, i think the quickest way to get any custom coding issues sorted is through premiere support. I don't know the code ray had implemented before, so it's going be tough for me to troubleshoot. Through premiere support, ray will be able to troubleshoot.
http://www.webassist.com/premier_request.php

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