Hi all,

First off, I don't know what the heck I'm doing - but trying to learn. I've been at this all day working from this post.

After 11 hrs, 3 crashes, and countless combinations of code and db changes I need to beg for help. It could be the way I set up the field in the orders table or my code.

Thanks in advance for any help!

In tpl_checkout_shipping.php I added (Seems to work) :
Code:
<fieldset>
<legend><?php echo TABLE_HEADING_INSURANCE; ?></legend>
<div><?php echo TEXT_INSURANCE_DESCRIPTION;?></div>
<?php echo zen_draw_checkbox_field('insurance', '1', false, 'id="insurance"');?>
<label class="checkboxLabel" for="insurance"><?php echo TEXT_INSURANCE_CONFIRM; ?></label>
</fieldset>
In order.php I added (in red):
Code:
<?php
/**
* File contains the order-processing class ("order")
*
* @package classes
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: order.php 5369 2006-12-23 10:55:52Z drbyte $
*/
/**
* order class
*
* Handles all order-processing functions
*
* @package classes
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
class order extends base {
var $info, $totals, $products, $customer, $delivery, $content_type, $email_low_stock, $products_ordered_attributes,
$products_ordered, $products_ordered_email;
function order($order_id = '') {
$this->info = array();
$this->totals = array();
$this->products = array();
$this->customer = array();
$this->delivery = array();
if (zen_not_null($order_id)) {
$this->query($order_id);
} else {
$this->cart();
}
}
function query($order_id) {
global $db;
$order_id = zen_db_prepare_input($order_id);
$order_query = "select customers_id, customers_name, customers_company,
customers_street_address, customers_suburb, customers_city,
customers_postcode, customers_state, customers_country,
customers_telephone, customers_email_address, customers_address_format_id,
delivery_name, delivery_company, delivery_street_address, delivery_suburb,
delivery_city, delivery_postcode, delivery_state, delivery_country,
delivery_address_format_id, billing_name, billing_company,
billing_street_address, billing_suburb, billing_city, billing_postcode,
billing_state, billing_country, billing_address_format_id,
payment_method, payment_module_code, shipping_method, shipping_module_code,
coupon_code, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value,
date_purchased, orders_status, last_modified, order_total, order_tax, insurance, ip_address
from " . TABLE_ORDERS . "
where orders_id = '" . (int)$order_id . "'";
 
more code...
 
$this->info = array('currency' => $order->fields['currency'],
'currency_value' => $order->fields['currency_value'],
'payment_method' => $order->fields['payment_method'],
'payment_module_code' => $order->fields['payment_module_code'],
'shipping_method' => $order->fields['shipping_method'],
'shipping_module_code' => $order->fields['shipping_module_code'],
'coupon_code' => $order->fields['coupon_code'],
'cc_type' => $order->fields['cc_type'],
'cc_owner' => $order->fields['cc_owner'],
'cc_number' => $order->fields['cc_number'],
'cc_expires' => $order->fields['cc_expires'],
'date_purchased' => $order->fields['date_purchased'],
'orders_status' => $order_status->fields['orders_status_name'],
'last_modified' => $order->fields['last_modified'],
'total' => $order->fields['order_total'],
'tax' => $order->fields['order_tax'],
'insurance' => $order->fields['insurance'],
'ip_address' => $order->fields['ip_address']
);
 
more code...
 
$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
'currency' => $_SESSION['currency'],
'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'],
'payment_method' => $GLOBALS[$class]->title,
'payment_module_code' => $GLOBALS[$class]->code,
'coupon_code' => $coupon_code->fields['coupon_code'],
// 'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),
// 'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),
// 'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),
// 'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),
// 'cc_cvv' => (isset($GLOBALS['cc_cvv']) ? $GLOBALS['cc_cvv'] : ''),
'shipping_method' => $_SESSION['shipping']['title'],
'shipping_module_code' => $_SESSION['shipping']['id'],
'shipping_cost' => $_SESSION['shipping']['cost'],
'subtotal' => 0,
'tax' => 0,
'total' => 0,
'tax_groups' => array(),
'comments' => (isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),
'insurance' => $_SESSION['insurance'],
'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
);
 
more code...
 
['shipping_module_code']),
'coupon_code' => $this->info['coupon_code'],
'cc_type' => $this->info['cc_type'],
'cc_owner' => $this->info['cc_owner'],
'cc_number' => $this->info['cc_number'],
'cc_expires' => $this->info['cc_expires'],
'date_purchased' => 'now()',
'orders_status' => $this->info['order_status'],
'order_total' => $this->info['total'],
'order_tax' => $this->info['tax'],
'currency' => $this->info['currency'],
'currency_value' => $this->info['currency_value'],
'order_insurance' => $this->info['insurance'],
'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
);
 
etc....
In header_php.php I added (in red)
Code:
<?php
 
Some Code....
 
$free_shipping = false;
if ( ($pass == true) && ($_SESSION['cart']->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
$free_shipping = true;
}
} else {
$free_shipping = false;
}
if (isset($_SESSION['insurance'])) {
$insurance = $_SESSION['insurance'];
}
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
if (isset($_SESSION['comments'])) {
$comments = $_SESSION['comments'];
}
// process the selected shipping method
if ( isset($_POST['action']) && ($_POST['action'] == 'process') ) {
if (zen_not_null($_POST['comments'])) {
$_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);
}
$comments = $_SESSION['comments'];
if (zen_not_null($_POST['insurance'])) {
$_SESSION['insurance'] = zen_db_prepare_input($_POST['insurance']);
}
$insurance = $_SESSION['insurance'];
if ( (zen_count_shipping_modules() > 0) || ($free_shipping == true) ) {
if ( (isset($_POST['shipping'])) && (strpos($_POST['shipping'], '_')) ) {
$_SESSION['shipping'] = $_POST['shipping'];
 
The rest of the code.....
I must be an idiot becouse there really wasn't a lot of questions in the origional post. Can you help an idiot out?

Thanks,

Steve