Zen 1.3.7 php5.2.5 Mysql4
I have added a checkbox to my checkout pages.
The idea is to offer the choice of agreeing to accept substitutes if something is out of stock.
It is called 'sub', and goes through from shipping,
Code for shipping header***********************************************************
if ( isset($_POST['action']) && ($_POST['action'] == 'process') ) {
if (zen_not_null($_POST['sub'])) {
$_SESSION['sub'] = zen_db_prepare_input($_POST['sub']);
}
$sub = $_SESSION['sub'];
to payment.
Code for payment header******************************************************
$sub = $_SESSION['sub'];
******************************************************************************** ***
At the checkout confirmation page, in the header I want the 0 or 1 of the
checkbox converted to text, so it appears on the confirmation page as Yes or No.
Code for header checkout confirmation..*********************************************************.
if ($_SESSION['sub'] == '1')
$_SESSION['substitutes'] = 'Yes';
else
$_SESSION['substitutes'] ='No';
$substitutes=$_SESSION['substitutes'] ;
$_SESSION['substitutes'] = zen_db_prepare_input($_POST['substitutes']);
******************************************************************************** *************************
That is parsed through ok to the confirmation tpl and appears as planned.
Code for checkout confirmation tpl**************************************************************
<?php echo ' '. $substitutes . zen_draw_hidden_field('substitutes', $order->info['substitutes']); ?>
OK that works alright.
My problem lies in getting it inserted into the database. I've made a new text field called substitutes in
TABLE orders_status_history, next to comments.
I've added to classes/orders.php, as below
'comments' => (isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),
'substitutes' => (isset($_SESSION['substitutes']) ? $_SESSION['substitutes'] : '')
And unset the session in checkout success header.
It works fine with php4, but since i've gone with php 5.2.5, I am getting the comments inserted ok, but the
substitutes is blank. There is no error or crash.
Can anyone please help me with this ?
http://thebeadman.com.au
Cheers
Emmdee
Bookmarks