Thank you Ray.
The Add to Cart behaviour isn't posting my hidden form field value. My guess is that it's not supposed to.
I added a Set Session Value behaviour:
<?php
@session_start();
if (!isset($_SESSION["eCartSMC_OrderID"])) {
$_SESSION["eCartSMC_OrderID"] = "".($rsEDITFORM->getColumnVal("SMCorderID")) ."";
}
?>
...so that the session would defintely exist, prior to clicking the Add to Cart button. Sure enough, when I display this session value on the add to cart page it exists, and it's the correct number (the order ID from my Orders table).
Clicking the Add to Cart button takes the user to the card/billing address page (health-screening-form-checkout.php) and, on that page, I have the following recordset:
<?php
$rsCONFIRMORDER = new WA_MySQLi_RS("rsCONFIRMORDER",$csdbmysqli,1);
$rsCONFIRMORDER->setQuery("SELECT SMCorders.*, SMCuser.*, userORDER.SMCuserFIRST AS USERORDERfirst, userORDER.SMCuserSUR AS USERORDERsur, userORDER.SMCuserUSER AS USERORDERemail, userORDER.SMCuserADD AS USERORDERadd, userORDER.SMCuserADD1 AS USERORDERadd1, userORDER.SMCuserCITY AS USERORDERcity, userORDER.SMCuserREGION AS USERORDERregion, userORDER.SMCuserZIP AS USERORDERzip, userORDER.SMCuserPHONE AS USERORDERphone, userORDER.SMCuserMOBILE AS USERORDERmobile, SMCcountries.SMCcountryID, SMCcountries.SMCcountryCODE, SMCcountries.SMCcountryNAME, SMCform.*
FROM SMCorders
INNER JOIN SMCuser ON SMCorders.SMCorderUSERID = SMCuser.SMCuserID
INNER JOIN SMCuser userORDER ON SMCorders.SMCorderUSERID = userORDER.SMCuserID
INNER JOIN SMCcountries ON userORDER.SMCuserCOUNTRY = SMCcountries.SMCcountryID
INNER JOIN SMCform ON SMCorders.SMCorderFORMID = SMCform.SMCformID
WHERE SMCorders.SMCorderID = ?");
$rsCONFIRMORDER->bindParam("i", "".(isset($_SESSION['eCartSMC_OrderID'])?$_SESSION['eCartSMC_OrderID']:"") ."", "-1"); //WAQB_Param1
$rsCONFIRMORDER->execute();
?>
This recordset is returning a record, because I have it populating the billing address fields. However, the cart summary section at the bottom has omitted the form ID and order ID, despite them being set in the Add to Cart behaviour on the previous page (itemName and itemDescription):
<?php
// WA eCart AddToCart
if (isset($_POST["eCartSMC_1_ATC"]) || isset($_POST["eCartSMC_1_ATC_x"])) {
$ATC_itemID = $rsEDITFORM->getColumnVal["SMCorderID"];
$ATC_AddIfIn = 4;
$ATC_RedirectAfter = "../health-screening-form-checkout.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "Sports Medical Certificate Form Ref ". $rsEDITFORM->getColumnVal("SMCformID") ."";// column binding
$ATC_itemDescription = "Order Ref SMC". $rsEDITFORM->getColumnVal("SMCorderID") ."";// column binding
$ATC_itemThumbnail = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = floatval("1");// column binding
$ATC_itemPrice = floatval("65");// column binding
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$eCartSMC->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemThumbnail, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice);
if ($ATC_RedirectAfter != "" && $eCartSMC->redirStr == "") {
$eCartSMC->redirStr = $ATC_RedirectAfter;
}
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
}
else {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF'];
}
}
}
?>
My conclusion is that this is nothing to do with the session values, it is simply that the Add to Cart behaviour is not allowing/storing the recordset values specified in the itemName and itemDescription sections, which is why they are not displaying in the cart summary section on the subsequent page. That's an issue that I can't resolve without your help.
Will Skype message you around 5pm GMT.
Thank you.
NJ