Update of /cvsroot/tep/catalog/catalog
In directory sc8-pr-cvs1:/tmp/cvs-serv4013
Modified Files:
checkout_confirmation.php checkout_payment.php
checkout_payment_address.php checkout_process.php
checkout_shipping.php checkout_shipping_address.php
checkout_success.php
Log Message:
use the new classes and super global variables
Index: checkout_confirmation.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/checkout_confirmation.php,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- checkout_confirmation.php 11 Jun 2003 17:34:53 -0000 1.139
+++ checkout_confirmation.php 17 Nov 2003 20:58:34 -0000 1.140
@@ -13,8 +13,9 @@
require('includes/application_top.php');
// if the customer is not logged on, redirect them to the login page
- if (!tep_session_is_registered('customer_id')) {
+ if ($osC_Customer->isLoggedOn() == false) {
$navigation->set_snapshot(array('mode' => 'SSL', 'page' =>
FILENAME_CHECKOUT_PAYMENT));
+
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
@@ -24,28 +25,29 @@
}
// avoid hack attempts during the checkout procedure by checking the internal
cartID
- if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
- if ($cart->cartID != $cartID) {
+ if (isset($cart->cartID) && $osC_Session->exists('cartID')) {
+ if ($cart->cartID != $osC_Session->value('cartID')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
}
// if no shipping method has been selected, redirect the customer to the
shipping method selection page
- if (!tep_session_is_registered('shipping')) {
+ if ($osC_Session->exists('shipping') == false) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
- if (!tep_session_is_registered('payment')) tep_session_register('payment');
- if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];
+ if (isset($_POST['payment'])) {
+ $osC_Session->set('payment', $_POST['payment']);
+ }
+ $payment =& $osC_Session->value('payment');
- if (!tep_session_is_registered('comments')) tep_session_register('comments');
- if (tep_not_null($HTTP_POST_VARS['comments'])) {
- $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
+ if (tep_not_null($_POST['comments'])) {
+ $osC_Session->set('comments', tep_db_prepare_input($_POST['comments']));
}
// load the selected payment module
require(DIR_WS_CLASSES . 'payment.php');
- $payment_modules = new payment($payment);
+ $payment_modules = new payment($osC_Session->value('payment'));
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
@@ -62,7 +64,7 @@
// load the selected shipping module
require(DIR_WS_CLASSES . 'shipping.php');
- $shipping_modules = new shipping($shipping);
+ $shipping_modules = new shipping($osC_Session->value('shipping'));
require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;
@@ -81,7 +83,7 @@
}
}
- require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);
+ require(DIR_WS_LANGUAGES . $osC_Session->value('language') . '/' .
FILENAME_CHECKOUT_CONFIRMATION);
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING,
'', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2);
@@ -124,7 +126,7 @@
<td><table border="0" width="100%" cellspacing="1" cellpadding="2"
class="infoBox">
<tr class="infoBoxContents">
<?php
- if ($sendto != false) {
+ if ($osC_Session->value('sendto') != false) {
?>
<td width="30%" valign="top"><table border="0" width="100%"
cellspacing="0" cellpadding="2">
<tr>
@@ -149,7 +151,7 @@
<?php
}
?>
- <td width="<?php echo (($sendto != false) ? '70%' : '100%'); ?>"
valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
+ <td width="<?php echo (($osC_Session->value('sendto') != false) ?
'70%' : '100%'); ?>" valign="top"><table border="0" width="100%"
cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0"
cellpadding="2">
<?php
Index: checkout_payment.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/checkout_payment.php,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- checkout_payment.php 29 Jun 2003 23:03:27 -0000 1.113
+++ checkout_payment.php 17 Nov 2003 20:58:34 -0000 1.114
@@ -13,8 +13,9 @@
require('includes/application_top.php');
// if the customer is not logged on, redirect them to the login page
- if (!tep_session_is_registered('customer_id')) {
+ if ($osC_Customer->isLoggedOn() == false) {
$navigation->set_snapshot();
+
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
@@ -24,13 +25,13 @@
}
// if no shipping method has been selected, redirect the customer to the
shipping method selection page
- if (!tep_session_is_registered('shipping')) {
+ if ($osC_Session->exists('shipping') == false) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
// avoid hack attempts during the checkout procedure by checking the internal
cartID
- if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
- if ($cart->cartID != $cartID) {
+ if (isset($cart->cartID) && $osC_Session->exists('cartID')) {
+ if ($cart->cartID != $osC_Session->value('cartID')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
}
@@ -47,25 +48,23 @@
}
// if no billing destination address was selected, use the customers own
address as default
- if (!tep_session_is_registered('billto')) {
- tep_session_register('billto');
- $billto = $customer_default_address_id;
+ if ($osC_Session->exists('billto') == false) {
+ $osC_Session->set('billto', $osC_Customer->default_address_id);
} else {
// verify the selected billing address
- $check_address_query = tep_db_query("select count(*) as total from " .
TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and
address_book_id = '" . (int)$billto . "'");
+ $check_address_query = tep_db_query("select count(*) as total from " .
TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$osC_Customer->id . "'
and address_book_id = '" . (int)$osC_Session->value('billto') . "'");
$check_address = tep_db_fetch_array($check_address_query);
if ($check_address['total'] != '1') {
- $billto = $customer_default_address_id;
- if (tep_session_is_registered('payment'))
tep_session_unregister('payment');
+ $osC_Session->set('billto', $osC_Customer->default_address_id);
+
+ $osC_Session->remove('payment');
}
}
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
- if (!tep_session_is_registered('comments')) tep_session_register('comments');
-
$total_weight = $cart->show_weight();
$total_count = $cart->count_contents();
@@ -73,7 +72,7 @@
require(DIR_WS_CLASSES . 'payment.php');
$payment_modules = new payment;
- require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);
+ require(DIR_WS_LANGUAGES . $osC_Session->value('language') . '/' .
FILENAME_CHECKOUT_PAYMENT);
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING,
'', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT,
'', 'SSL'));
@@ -146,7 +145,7 @@
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10');
?></td>
</tr>
<?php
- if (isset($HTTP_GET_VARS['payment_error']) &&
is_object(${$HTTP_GET_VARS['payment_error']}) && ($error =
${$HTTP_GET_VARS['payment_error']}->get_error())) {
+ if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) &&
($error = ${$_GET['payment_error']}->get_error())) {
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
@@ -186,14 +185,14 @@
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
- <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
<td class="main" width="50%" valign="top"><?php echo
TEXT_SELECTED_BILLING_DESTINATION; ?><br><br><?php echo '<a href="' .
tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' .
tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) .
'</a>'; ?></td>
<td align="right" width="50%" valign="top"><table border="0"
cellspacing="0" cellpadding="2">
<tr>
<td class="main" align="center" valign="top"><b><?php echo
TITLE_BILLING_ADDRESS; ?></b><br><?php echo tep_image(DIR_WS_IMAGES .
'arrow_south_east.gif'); ?></td>
- <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
- <td class="main" valign="top"><?php echo
tep_address_label($customer_id, $billto, true, ' ', '<br>'); ?></td>
- <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
+ <td class="main" valign="top"><?php echo
tep_address_label($osC_Customer->id, $osC_Session->value('billto'), true, ' ',
'<br>'); ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
</tr>
</table></td>
</tr>
@@ -239,12 +238,14 @@
$radio_buttons = 0;
for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
+ $checked = ($selection[$i]['id'] == $osC_Session->value('payment') ? true
: false);
+
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
<td colspan="2"><table border="0" width="100%" cellspacing="0"
cellpadding="2">
<?php
- if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {
+ if ( ($checked == true) || ($n == 1) ) {
echo ' <tr id="defaultSelected"
class="moduleRowSelected" onmouseover="rowOverEffect(this)"
onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' .
$radio_buttons . ')">' . "\n";
} else {
echo ' <tr class="moduleRow"
onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"
onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
@@ -255,7 +256,7 @@
<td class="main" align="right">
<?php
if (sizeof($selection) > 1) {
- echo tep_draw_radio_field('payment', $selection[$i]['id']);
+ echo tep_draw_radio_field('payment', $selection[$i]['id'], $checked);
} else {
echo tep_draw_hidden_field('payment', $selection[$i]['id']);
}
Index: checkout_payment_address.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/checkout_payment_address.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- checkout_payment_address.php 9 Jun 2003 23:03:53 -0000 1.14
+++ checkout_payment_address.php 17 Nov 2003 20:58:34 -0000 1.15
@@ -13,8 +13,9 @@
require('includes/application_top.php');
// if the customer is not logged on, redirect them to the login page
- if (!tep_session_is_registered('customer_id')) {
+ if ($osC_Customer->isLoggedOn() == false) {
$navigation->set_snapshot();
+
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
@@ -24,31 +25,31 @@
}
// needs to be included earlier to set the success message in the messageStack
- require(DIR_WS_LANGUAGES . $language . '/' .
FILENAME_CHECKOUT_PAYMENT_ADDRESS);
+ require(DIR_WS_LANGUAGES . $osC_Session->value('language') . '/' .
FILENAME_CHECKOUT_PAYMENT_ADDRESS);
$error = false;
$process = false;
- if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] ==
'submit')) {
+ if (isset($_POST['action']) && ($_POST['action'] == 'submit')) {
// process a new billing address
- if (tep_not_null($HTTP_POST_VARS['firstname']) &&
tep_not_null($HTTP_POST_VARS['lastname']) &&
tep_not_null($HTTP_POST_VARS['street_address'])) {
+ if (tep_not_null($_POST['firstname']) && tep_not_null($_POST['lastname'])
&& tep_not_null($_POST['street_address'])) {
$process = true;
- if (ACCOUNT_GENDER == 'true') $gender =
tep_db_prepare_input($HTTP_POST_VARS['gender']);
- if (ACCOUNT_COMPANY == 'true') $company =
tep_db_prepare_input($HTTP_POST_VARS['company']);
- $firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
- $lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
- $street_address =
tep_db_prepare_input($HTTP_POST_VARS['street_address']);
- if (ACCOUNT_SUBURB == 'true') $suburb =
tep_db_prepare_input($HTTP_POST_VARS['suburb']);
- $postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
- $city = tep_db_prepare_input($HTTP_POST_VARS['city']);
- $country = tep_db_prepare_input($HTTP_POST_VARS['country']);
+ if (ACCOUNT_GENDER == 'true') $gender =
tep_db_prepare_input($_POST['gender']);
+ if (ACCOUNT_COMPANY == 'true') $company =
tep_db_prepare_input($_POST['company']);
+ $firstname = tep_db_prepare_input($_POST['firstname']);
+ $lastname = tep_db_prepare_input($_POST['lastname']);
+ $street_address = tep_db_prepare_input($_POST['street_address']);
+ if (ACCOUNT_SUBURB == 'true') $suburb =
tep_db_prepare_input($_POST['suburb']);
+ $postcode = tep_db_prepare_input($_POST['postcode']);
+ $city = tep_db_prepare_input($_POST['city']);
+ $country = tep_db_prepare_input($_POST['country']);
if (ACCOUNT_STATE == 'true') {
- if (isset($HTTP_POST_VARS['zone_id'])) {
- $zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
+ if (isset($_POST['zone_id'])) {
+ $zone_id = tep_db_prepare_input($_POST['zone_id']);
} else {
$zone_id = false;
}
- $state = tep_db_prepare_input($HTTP_POST_VARS['state']);
+ $state = tep_db_prepare_input($_POST['state']);
}
if (ACCOUNT_GENDER == 'true') {
@@ -120,7 +121,7 @@
}
if ($error == false) {
- $sql_data_array = array('customers_id' => $customer_id,
+ $sql_data_array = array('customers_id' => $osC_Customer->id,
'entry_firstname' => $firstname,
'entry_lastname' => $lastname,
'entry_street_address' => $street_address,
@@ -141,52 +142,50 @@
}
}
- if (!tep_session_is_registered('billto'))
tep_session_register('billto');
-
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
- $billto = tep_db_insert_id();
+ $osC_Session->set('billto', tep_db_insert_id());
- if (tep_session_is_registered('payment'))
tep_session_unregister('payment');
+ $osC_Session->remove('payment');
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
// process the selected billing destination
- } elseif (isset($HTTP_POST_VARS['address'])) {
+ } elseif (isset($_POST['address'])) {
$reset_payment = false;
- if (tep_session_is_registered('billto')) {
- if ($billto != $HTTP_POST_VARS['address']) {
- if (tep_session_is_registered('payment')) {
+ if ($osC_Session->exists('billto')) {
+ if ($osC_Session->value('billto') != $_POST['address']) {
+ if ($osC_Session->exists('payment')) {
$reset_payment = true;
}
}
- } else {
- tep_session_register('billto');
}
- $billto = $HTTP_POST_VARS['address'];
+ $osC_Session->set('billto', $_POST['address']);
- $check_address_query = tep_db_query("select count(*) as total from " .
TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "' and
address_book_id = '" . $billto . "'");
+ $check_address_query = tep_db_query("select count(*) as total from " .
TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$osC_Customer->id . "'
and address_book_id = '" . (int)$osC_Session->value('billto') . "'");
$check_address = tep_db_fetch_array($check_address_query);
if ($check_address['total'] == '1') {
- if ($reset_payment == true) tep_session_unregister('payment');
+ if ($reset_payment == true) {
+ $osC_Session->remove('payment');
+ }
+
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
} else {
- tep_session_unregister('billto');
+ $osC_Session->remove('billto');
}
// no addresses to select from - customer decided to keep the current assigned
address
} else {
- if (!tep_session_is_registered('billto')) tep_session_register('billto');
- $billto = $customer_default_address_id;
+ $osC_Session->set('billto', $osC_Customer->default_address_id);
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
}
// if no billing destination address was selected, use their own address as
default
- if (!tep_session_is_registered('billto')) {
- $billto = $customer_default_address_id;
+ if ($osC_Session->exists('billto') == false) {
+ $osC_Session->set('billto', $osC_Customer->default_address_id);
}
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_PAYMENT,
'', 'SSL'));
@@ -307,7 +306,7 @@
<tr>
<td class="main" align="center" valign="top"><?php echo
'<b>' . TITLE_PAYMENT_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES .
'arrow_south_east.gif'); ?></td>
<td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
- <td class="main" valign="top"><?php echo
tep_address_label($customer_id, $billto, true, ' ', '<br>'); ?></td>
+ <td class="main" valign="top"><?php echo
tep_address_label($osC_Customer->id, $osC_Session->value('billto'), true, ' ',
'<br>'); ?></td>
<td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
</tr>
</table></td>
@@ -342,7 +341,7 @@
<?php
$radio_buttons = 0;
- $addresses_query = tep_db_query("select address_book_id, entry_firstname
as firstname, entry_lastname as lastname, entry_company as company,
entry_street_address as street_address, entry_suburb as suburb, entry_city as
city, entry_postcode as postcode, entry_state as state, entry_zone_id as
zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where
customers_id = '" . $customer_id . "'");
+ $addresses_query = tep_db_query("select address_book_id, entry_firstname
as firstname, entry_lastname as lastname, entry_company as company,
entry_street_address as street_address, entry_suburb as suburb, entry_city as
city, entry_postcode as postcode, entry_state as state, entry_zone_id as
zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where
customers_id = '" . (int)$osC_Customer->id . "'");
while ($addresses = tep_db_fetch_array($addresses_query)) {
$format_id = tep_get_address_format_id($addresses['country_id']);
?>
@@ -350,7 +349,7 @@
<td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
<td colspan="2"><table border="0" width="100%" cellspacing="0"
cellpadding="2">
<?php
- if ($addresses['address_book_id'] == $billto) {
+ if ($addresses['address_book_id'] == $osC_Session->value('billto')) {
echo ' <tr id="defaultSelected"
class="moduleRowSelected" onmouseover="rowOverEffect(this)"
onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' .
$radio_buttons . ')">' . "\n";
} else {
echo ' <tr class="moduleRow"
onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"
onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
@@ -358,7 +357,7 @@
?>
<td width="10"><?php echo
tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main" colspan="2"><b><?php echo
$addresses['firstname'] . ' ' . $addresses['lastname']; ?></b></td>
- <td class="main" align="right"><?php echo
tep_draw_radio_field('address', $addresses['address_book_id'],
($addresses['address_book_id'] == $billto)); ?></td>
+ <td class="main" align="right"><?php echo
tep_draw_radio_field('address', $addresses['address_book_id'],
($addresses['address_book_id'] == $osC_Session->value('billto'))); ?></td>
<td width="10"><?php echo
tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
<tr>
Index: checkout_process.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/checkout_process.php,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- checkout_process.php 28 May 2003 18:00:29 -0000 1.128
+++ checkout_process.php 17 Nov 2003 20:58:34 -0000 1.129
@@ -13,35 +13,34 @@
include('includes/application_top.php');
// if the customer is not logged on, redirect them to the login page
- if (!tep_session_is_registered('customer_id')) {
+ if ($osC_Customer->isLoggedOn() == false) {
$navigation->set_snapshot(array('mode' => 'SSL', 'page' =>
FILENAME_CHECKOUT_PAYMENT));
+
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
-
- if (!tep_session_is_registered('sendto')) {
+
+ if ($osC_Session->exists('sendto') == false) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
- if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) &&
(!tep_session_is_registered('payment')) ) {
+ if (tep_not_null(MODULE_PAYMENT_INSTALLED) &&
($osC_Session->exists('payment') == false)) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
// avoid hack attempts during the checkout procedure by checking the internal
cartID
- if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
- if ($cart->cartID != $cartID) {
- tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
- }
+ if (isset($cart->cartID) && $osC_Session->exists('cartID') && ($cart->cartID
!= $osC_Session->value('cartID'))) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
- include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);
+ include(DIR_WS_LANGUAGES . $osC_Session->value('language') . '/' .
FILENAME_CHECKOUT_PROCESS);
// load selected payment module
require(DIR_WS_CLASSES . 'payment.php');
- $payment_modules = new payment($payment);
+ $payment_modules = new payment($osC_Session->value('payment'));
// load the selected shipping module
require(DIR_WS_CLASSES . 'shipping.php');
- $shipping_modules = new shipping($shipping);
+ $shipping_modules = new shipping($osC_Session->value('shipping'));
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
@@ -54,75 +53,83 @@
$order_totals = $order_total_modules->process();
- $sql_data_array = array('customers_id' => $customer_id,
+ $sql_data_array = array('customers_id' => $osC_Customer->id,
'customers_name' => $order->customer['firstname'] .
' ' . $order->customer['lastname'],
'customers_company' => $order->customer['company'],
'customers_street_address' =>
$order->customer['street_address'],
'customers_suburb' => $order->customer['suburb'],
'customers_city' => $order->customer['city'],
- 'customers_postcode' =>
$order->customer['postcode'],
- 'customers_state' => $order->customer['state'],
- 'customers_country' =>
$order->customer['country']['title'],
- 'customers_telephone' =>
$order->customer['telephone'],
+ 'customers_postcode' => $order->customer['postcode'],
+ 'customers_state' => $order->customer['state'],
+ 'customers_country' =>
$order->customer['country']['title'],
+ 'customers_telephone' =>
$order->customer['telephone'],
'customers_email_address' =>
$order->customer['email_address'],
- 'customers_address_format_id' =>
$order->customer['format_id'],
- 'delivery_name' => $order->delivery['firstname'] . '
' . $order->delivery['lastname'],
+ 'customers_address_format_id' =>
$order->customer['format_id'],
+ 'delivery_name' => $order->delivery['firstname'] . '
' . $order->delivery['lastname'],
'delivery_company' => $order->delivery['company'],
- 'delivery_street_address' =>
$order->delivery['street_address'],
- 'delivery_suburb' => $order->delivery['suburb'],
- 'delivery_city' => $order->delivery['city'],
- 'delivery_postcode' => $order->delivery['postcode'],
- 'delivery_state' => $order->delivery['state'],
- 'delivery_country' =>
$order->delivery['country']['title'],
- 'delivery_address_format_id' =>
$order->delivery['format_id'],
- 'billing_name' => $order->billing['firstname'] . ' '
. $order->billing['lastname'],
+ 'delivery_street_address' =>
$order->delivery['street_address'],
+ 'delivery_suburb' => $order->delivery['suburb'],
+ 'delivery_city' => $order->delivery['city'],
+ 'delivery_postcode' => $order->delivery['postcode'],
+ 'delivery_state' => $order->delivery['state'],
+ 'delivery_country' =>
$order->delivery['country']['title'],
+ 'delivery_address_format_id' =>
$order->delivery['format_id'],
+ 'billing_name' => $order->billing['firstname'] . ' '
. $order->billing['lastname'],
'billing_company' => $order->billing['company'],
- 'billing_street_address' =>
$order->billing['street_address'],
- 'billing_suburb' => $order->billing['suburb'],
- 'billing_city' => $order->billing['city'],
- 'billing_postcode' => $order->billing['postcode'],
- 'billing_state' => $order->billing['state'],
- 'billing_country' =>
$order->billing['country']['title'],
- 'billing_address_format_id' =>
$order->billing['format_id'],
- 'payment_method' => $order->info['payment_method'],
- 'cc_type' => $order->info['cc_type'],
- 'cc_owner' => $order->info['cc_owner'],
- 'cc_number' => $order->info['cc_number'],
- 'cc_expires' => $order->info['cc_expires'],
- 'date_purchased' => 'now()',
- 'orders_status' => $order->info['order_status'],
- 'currency' => $order->info['currency'],
+ 'billing_street_address' =>
$order->billing['street_address'],
+ 'billing_suburb' => $order->billing['suburb'],
+ 'billing_city' => $order->billing['city'],
+ 'billing_postcode' => $order->billing['postcode'],
+ 'billing_state' => $order->billing['state'],
+ 'billing_country' =>
$order->billing['country']['title'],
+ 'billing_address_format_id' =>
$order->billing['format_id'],
+ 'payment_method' => $order->info['payment_method'],
+ 'cc_type' => $order->info['cc_type'],
+ 'cc_owner' => $order->info['cc_owner'],
+ 'cc_number' => $order->info['cc_number'],
+ 'cc_expires' => $order->info['cc_expires'],
+ 'date_purchased' => 'now()',
+ 'orders_status' => $order->info['order_status'],
+ 'currency' => $order->info['currency'],
'currency_value' => $order->info['currency_value']);
+
tep_db_perform(TABLE_ORDERS, $sql_data_array);
+
$insert_id = tep_db_insert_id();
+
for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$sql_data_array = array('orders_id' => $insert_id,
'title' => $order_totals[$i]['title'],
'text' => $order_totals[$i]['text'],
- 'value' => $order_totals[$i]['value'],
- 'class' => $order_totals[$i]['code'],
+ 'value' => $order_totals[$i]['value'],
+ 'class' => $order_totals[$i]['code'],
'sort_order' => $order_totals[$i]['sort_order']);
+
tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
}
$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
- $sql_data_array = array('orders_id' => $insert_id,
- 'orders_status_id' => $order->info['order_status'],
- 'date_added' => 'now()',
+
+ $sql_data_array = array('orders_id' => $insert_id,
+ 'orders_status_id' => $order->info['order_status'],
+ 'date_added' => 'now()',
'customer_notified' => $customer_notification,
'comments' => $order->info['comments']);
+
tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
// initialized for the email confirmation
$products_ordered = '';
$subtotal = 0;
$total_tax = 0;
+ $total_weight = 0;
+ $total_cost = 0;
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
if (DOWNLOAD_ENABLED == 'true') {
- $stock_query_raw = "SELECT products_quantity,
pad.products_attributes_filename
+ $stock_query_raw = "SELECT products_quantity,
pad.products_attributes_filename
FROM " . TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
ON p.products_id=pa.products_id
@@ -157,13 +164,13 @@
// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered =
products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where
products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
- $sql_data_array = array('orders_id' => $insert_id,
- 'products_id' =>
tep_get_prid($order->products[$i]['id']),
- 'products_model' => $order->products[$i]['model'],
- 'products_name' => $order->products[$i]['name'],
- 'products_price' => $order->products[$i]['price'],
- 'final_price' =>
$order->products[$i]['final_price'],
- 'products_tax' => $order->products[$i]['tax'],
+ $sql_data_array = array('orders_id' => $insert_id,
+ 'products_id' =>
tep_get_prid($order->products[$i]['id']),
+ 'products_model' => $order->products[$i]['model'],
+ 'products_name' => $order->products[$i]['name'],
+ 'products_price' => $order->products[$i]['price'],
+ 'final_price' =>
$order->products[$i]['final_price'],
+ 'products_tax' => $order->products[$i]['tax'],
'products_quantity' =>
$order->products[$i]['qty']);
tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = tep_db_insert_id();
@@ -175,36 +182,36 @@
$attributes_exist = '1';
for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++)
{
if (DOWNLOAD_ENABLED == 'true') {
- $attributes_query = "select popt.products_options_name,
poval.products_options_values_name, pa.options_values_price, pa.price_prefix,
pad.products_attributes_maxdays, pad.products_attributes_maxcount ,
pad.products_attributes_filename
- from " . TABLE_PRODUCTS_OPTIONS . " popt, " .
TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
+ $attributes_query = "select popt.products_options_name,
poval.products_options_values_name, pa.options_values_price, pa.price_prefix,
pad.products_attributes_maxdays, pad.products_attributes_maxcount ,
pad.products_attributes_filename
+ from " . TABLE_PRODUCTS_OPTIONS . " popt, " .
TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
left join " .
TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
on
pa.products_attributes_id=pad.products_attributes_id
- where pa.products_id = '" .
$order->products[$i]['id'] . "'
- and pa.options_id = '" .
$order->products[$i]['attributes'][$j]['option_id'] . "'
- and pa.options_id = popt.products_options_id
- and pa.options_values_id = '" .
$order->products[$i]['attributes'][$j]['value_id'] . "'
- and pa.options_values_id =
poval.products_options_values_id
- and popt.language_id = '" . $languages_id . "'
- and poval.language_id = '" . $languages_id .
"'";
+ where pa.products_id = '" .
$order->products[$i]['id'] . "'
+ and pa.options_id = '" .
$order->products[$i]['attributes'][$j]['option_id'] . "'
+ and pa.options_id = popt.products_options_id
+ and pa.options_values_id = '" .
$order->products[$i]['attributes'][$j]['value_id'] . "'
+ and pa.options_values_id =
poval.products_options_values_id
+ and popt.language_id = '" .
$osC_Session->value('languages_id') . "'
+ and poval.language_id = '" .
$osC_Session->value('languages_id') . "'";
$attributes = tep_db_query($attributes_query);
} else {
- $attributes = tep_db_query("select popt.products_options_name,
poval.products_options_values_name, pa.options_values_price, pa.price_prefix
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . "
poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" .
$order->products[$i]['id'] . "' and pa.options_id = '" .
$order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id =
popt.products_options_id and pa.options_values_id = '" .
$order->products[$i]['attributes'][$j]['value_id'] . "' and
pa.options_values_id = poval.products_options_values_id and popt.language_id =
'" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
+ $attributes = tep_db_query("select popt.products_options_name,
poval.products_options_values_name, pa.options_values_price, pa.price_prefix
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . "
poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" .
$order->products[$i]['id'] . "' and pa.options_id = '" .
$order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id =
popt.products_options_id and pa.options_values_id = '" .
$order->products[$i]['attributes'][$j]['value_id'] . "' and
pa.options_values_id = poval.products_options_values_id and popt.language_id =
'" . $osC_Session->value('languages_id') . "' and poval.language_id = '" .
$osC_Session->value('languages_id') . "'");
}
$attributes_values = tep_db_fetch_array($attributes);
- $sql_data_array = array('orders_id' => $insert_id,
- 'orders_products_id' => $order_products_id,
+ $sql_data_array = array('orders_id' => $insert_id,
+ 'orders_products_id' => $order_products_id,
'products_options' =>
$attributes_values['products_options_name'],
- 'products_options_values' =>
$attributes_values['products_options_values_name'],
- 'options_values_price' =>
$attributes_values['options_values_price'],
+ 'products_options_values' =>
$attributes_values['products_options_values_name'],
+ 'options_values_price' =>
$attributes_values['options_values_price'],
'price_prefix' =>
$attributes_values['price_prefix']);
tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
if ((DOWNLOAD_ENABLED == 'true') &&
isset($attributes_values['products_attributes_filename']) &&
tep_not_null($attributes_values['products_attributes_filename'])) {
- $sql_data_array = array('orders_id' => $insert_id,
- 'orders_products_id' => $order_products_id,
- 'orders_products_filename' =>
$attributes_values['products_attributes_filename'],
- 'download_maxdays' =>
$attributes_values['products_attributes_maxdays'],
+ $sql_data_array = array('orders_id' => $insert_id,
+ 'orders_products_id' => $order_products_id,
+ 'orders_products_filename' =>
$attributes_values['products_attributes_filename'],
+ 'download_maxdays' =>
$attributes_values['products_attributes_maxdays'],
'download_count' =>
$attributes_values['products_attributes_maxcount']);
tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
}
@@ -213,24 +220,24 @@
}
//------insert customer choosen option eof ----
$total_weight += ($order->products[$i]['qty'] *
$order->products[$i]['weight']);
- $total_tax += tep_calculate_tax($total_products_price, $products_tax) *
$order->products[$i]['qty'];
- $total_cost += $total_products_price;
+ $total_tax += tep_calculate_tax($order->products[$i]['final_price'],
$order->products[$i]['tax']) * $order->products[$i]['qty'];
+ $total_cost += $order->products[$i]['final_price'];
$products_ordered .= $order->products[$i]['qty'] . ' x ' .
$order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' .
$currencies->display_price($order->products[$i]['final_price'],
$order->products[$i]['tax'], $order->products[$i]['qty']) .
$products_ordered_attributes . "\n";
}
// lets start with the email confirmation
- $email_order = STORE_NAME . "\n" .
- EMAIL_SEPARATOR . "\n" .
+ $email_order = STORE_NAME . "\n" .
+ EMAIL_SEPARATOR . "\n" .
EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
EMAIL_TEXT_INVOICE_URL . ' ' .
tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL',
false) . "\n" .
EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) .
"\n\n";
if ($order->info['comments']) {
$email_order .= tep_db_output($order->info['comments']) . "\n\n";
}
- $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
- EMAIL_SEPARATOR . "\n" .
- $products_ordered .
+ $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
+ EMAIL_SEPARATOR . "\n" .
+ $products_ordered .
EMAIL_SEPARATOR . "\n";
for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
@@ -238,20 +245,23 @@
}
if ($order->content_type != 'virtual') {
- $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
+ $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
EMAIL_SEPARATOR . "\n" .
- tep_address_label($customer_id, $sendto, 0, '', "\n") .
"\n";
+ tep_address_label($osC_Customer->id,
$osC_Session->value('sendto'), 0, '', "\n") . "\n";
}
$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
EMAIL_SEPARATOR . "\n" .
- tep_address_label($customer_id, $billto, 0, '', "\n") .
"\n\n";
+ tep_address_label($osC_Customer->id,
$osC_Session->value('billto'), 0, '', "\n") . "\n\n";
+
+ $payment =& $osC_Session->value('payment');
+
if (is_object($$payment)) {
- $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
+ $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n";
- if ($payment_class->email_footer) {
+ if (isset($payment_class->email_footer)) {
$email_order .= $payment_class->email_footer . "\n\n";
}
}
@@ -268,11 +278,11 @@
$cart->reset(true);
// unregister session variables used during checkout
- tep_session_unregister('sendto');
- tep_session_unregister('billto');
- tep_session_unregister('shipping');
- tep_session_unregister('payment');
- tep_session_unregister('comments');
+ $osC_Session->remove('sendto');
+ $osC_Session->remove('billto');
+ $osC_Session->remove('shipping');
+ $osC_Session->remove('payment');
+ $osC_Session->remove('comments');
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
Index: checkout_shipping.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/checkout_shipping.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- checkout_shipping.php 9 Jun 2003 23:03:53 -0000 1.16
+++ checkout_shipping.php 17 Nov 2003 20:58:34 -0000 1.17
@@ -14,8 +14,9 @@
require('includes/classes/http_client.php');
// if the customer is not logged on, redirect them to the login page
- if (!tep_session_is_registered('customer_id')) {
+ if ($osC_Customer->isLoggedOn() == false) {
$navigation->set_snapshot();
+
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
@@ -25,17 +26,17 @@
}
// if no shipping destination address was selected, use the customers own
address as default
- if (!tep_session_is_registered('sendto')) {
- tep_session_register('sendto');
- $sendto = $customer_default_address_id;
+ if ($osC_Session->exists('sendto') == false) {
+ $osC_Session->set('sendto', $osC_Customer->default_address_id);
} else {
// verify the selected shipping address
- $check_address_query = tep_db_query("select count(*) as total from " .
TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and
address_book_id = '" . (int)$sendto . "'");
+ $check_address_query = tep_db_query("select count(*) as total from " .
TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$osC_Customer->id . "'
and address_book_id = '" . (int)$osC_Session->value('sendto') . "'");
$check_address = tep_db_fetch_array($check_address_query);
if ($check_address['total'] != '1') {
- $sendto = $customer_default_address_id;
- if (tep_session_is_registered('shipping'))
tep_session_unregister('shipping');
+ $osC_Session->set('sendto', $osC_Customer->default_address_id);
+
+ $osC_Session->remove('shipping');
}
}
@@ -44,15 +45,14 @@
// register a random ID in the session to check throughout the checkout
procedure
// against alterations in the shopping cart contents
- if (!tep_session_is_registered('cartID')) tep_session_register('cartID');
- $cartID = $cart->cartID;
+ $osC_Session->set('cartID', $cart->cartID);
// if the order contains only virtual products, forward the customer to the
billing page as
// a shipping address is not needed
if ($order->content_type == 'virtual') {
- if (!tep_session_is_registered('shipping'))
tep_session_register('shipping');
- $shipping = false;
- $sendto = false;
+ $osC_Session->set('shipping', false);
+ $osC_Session->set('sendto', false);
+
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
@@ -63,7 +63,7 @@
require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping;
- if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') &&
(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
+ if (defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') &&
(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) {
$pass = false;
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
@@ -86,53 +86,51 @@
if ( ($pass == true) && ($order->info['total'] >=
MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
$free_shipping = true;
- include(DIR_WS_LANGUAGES . $language .
'/modules/order_total/ot_shipping.php');
+ include(DIR_WS_LANGUAGES . $osC_Session->value('language') .
'/modules/order_total/ot_shipping.php');
}
} else {
$free_shipping = false;
}
// process the selected shipping method
- if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] ==
'process') ) {
- if (!tep_session_is_registered('comments'))
tep_session_register('comments');
- if (tep_not_null($HTTP_POST_VARS['comments'])) {
- $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
+ if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
+ if (tep_not_null($_POST['comments'])) {
+ $osC_Session->set('comments', tep_db_prepare_input($_POST['comments']));
}
- if (!tep_session_is_registered('shipping'))
tep_session_register('shipping');
-
if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {
- if ( (isset($HTTP_POST_VARS['shipping'])) &&
(strpos($HTTP_POST_VARS['shipping'], '_')) ) {
- $shipping = $HTTP_POST_VARS['shipping'];
+ if (isset($_POST['shipping']) && strpos($_POST['shipping'], '_')) {
+ $osC_Session->set('shipping', $_POST['shipping']);
- list($module, $method) = explode('_', $shipping);
- if ( is_object($$module) || ($shipping == 'free_free') ) {
- if ($shipping == 'free_free') {
+ list($module, $method) = explode('_', $osC_Session->value('shipping'));
+ if (is_object($$module) || ($osC_Session->value('shipping') ==
'free_free')) {
+ if ($osC_Session->value('shipping') == 'free_free') {
$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
$quote[0]['methods'][0]['cost'] = '0';
} else {
$quote = $shipping_modules->quote($method, $module);
}
+
if (isset($quote['error'])) {
- tep_session_unregister('shipping');
+ $osC_Session->remove('shipping');
} else {
- if ( (isset($quote[0]['methods'][0]['title'])) &&
(isset($quote[0]['methods'][0]['cost'])) ) {
- $shipping = array('id' => $shipping,
- 'title' => (($free_shipping == true) ?
$quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' .
$quote[0]['methods'][0]['title'] . ')'),
- 'cost' => $quote[0]['methods'][0]['cost']);
+ if (isset($quote[0]['methods'][0]['title']) &&
isset($quote[0]['methods'][0]['cost'])) {
+ $osC_Session->set('shipping', array('id' =>
$osC_Session->value('shipping'),
+ 'title' => (($free_shipping
== true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' .
$quote[0]['methods'][0]['title'] . ')'),
+ 'cost' =>
$quote[0]['methods'][0]['cost']));
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '',
'SSL'));
}
}
} else {
- tep_session_unregister('shipping');
+ $osC_Session->remove('shipping');
}
}
} else {
- $shipping = false;
-
+ $osC_Session->set('shipping', false);
+
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
- }
+ }
}
// get all available shipping quotes
@@ -142,9 +140,11 @@
// if the modules status was changed when none were available, to save on
implementing
// a javascript force-selection method, also automatically select the cheapest
shipping
// method if more than one module is now enabled
- if ( !tep_session_is_registered('shipping') || (
tep_session_is_registered('shipping') && ($shipping == false) &&
(tep_count_shipping_modules() > 1) ) ) $shipping =
$shipping_modules->cheapest();
+ if ( ($osC_Session->exists('shipping') == false) ||
($osC_Session->exists('shipping') && ($osC_Session->value('shipping') == false)
&& (tep_count_shipping_modules() > 1)) ) {
+ $osC_Session->set('shipping', $shipping_modules->cheapest());
+ }
- require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);
+ require(DIR_WS_LANGUAGES . $osC_Session->value('language') . '/' .
FILENAME_CHECKOUT_SHIPPING);
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING,
'', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING,
'', 'SSL'));
@@ -227,14 +227,14 @@
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
- <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
<td class="main" width="50%" valign="top"><?php echo
TEXT_CHOOSE_SHIPPING_DESTINATION . '<br><br><a href="' .
tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' .
tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) .
'</a>'; ?></td>
<td align="right" width="50%" valign="top"><table border="0"
cellspacing="0" cellpadding="2">
<tr>
<td class="main" align="center" valign="top"><?php echo
'<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES .
'arrow_south_east.gif'); ?></td>
- <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
- <td class="main" valign="top"><?php echo
tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td>
- <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
+ <td class="main" valign="top"><?php echo
tep_address_label($osC_Customer->id, $osC_Session->value('sendto'), true, ' ',
'<br>'); ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
</tr>
</table></td>
</tr>
@@ -295,7 +295,7 @@
<td width="10"><?php echo
tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
- <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
</tr>
<?php
} else {
@@ -322,9 +322,9 @@
} else {
for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
- $checked = (($quotes[$i]['id'] . '_' .
$quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);
+ $checked = (($quotes[$i]['id'] . '_' .
$quotes[$i]['methods'][$j]['id'] == $osC_Session->value('shipping')) ? true :
false);
- if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
+ if ( ($checked == true) || ( ($n == 1) && ($n2 == 1) ) ) {
echo ' <tr id="defaultSelected"
class="moduleRowSelected" onmouseover="rowOverEffect(this)"
onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' .
$radio_buttons . ')">' . "\n";
} else {
echo ' <tr class="moduleRow"
onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"
onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
@@ -352,7 +352,7 @@
}
?>
</table></td>
- <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
</tr>
<?php
}
Index: checkout_shipping_address.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/checkout_shipping_address.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- checkout_shipping_address.php 9 Jun 2003 23:03:53 -0000 1.15
+++ checkout_shipping_address.php 17 Nov 2003 20:58:34 -0000 1.16
@@ -13,8 +13,9 @@
require('includes/application_top.php');
// if the customer is not logged on, redirect them to the login page
- if (!tep_session_is_registered('customer_id')) {
+ if ($osC_Customer->isLoggedOn() == false) {
$navigation->set_snapshot();
+
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
@@ -24,7 +25,7 @@
}
// needs to be included earlier to set the success message in the
messageStack
- require(DIR_WS_LANGUAGES . $language . '/' .
FILENAME_CHECKOUT_SHIPPING_ADDRESS);
+ require(DIR_WS_LANGUAGES . $osC_Session->value('language') . '/' .
FILENAME_CHECKOUT_SHIPPING_ADDRESS);
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
@@ -32,36 +33,35 @@
// if the order contains only virtual products, forward the customer to the
billing page as
// a shipping address is not needed
if ($order->content_type == 'virtual') {
- if (!tep_session_is_registered('shipping'))
tep_session_register('shipping');
- $shipping = false;
- if (!tep_session_is_registered('sendto')) tep_session_register('sendto');
- $sendto = false;
+ $osC_Session->set('shipping'. false);
+ $osC_Session->set('sendto', false);
+
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
$error = false;
$process = false;
- if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] ==
'submit')) {
+ if (isset($_POST['action']) && ($_POST['action'] == 'submit')) {
// process a new shipping address
- if (tep_not_null($HTTP_POST_VARS['firstname']) &&
tep_not_null($HTTP_POST_VARS['lastname']) &&
tep_not_null($HTTP_POST_VARS['street_address'])) {
+ if (tep_not_null($_POST['firstname']) && tep_not_null($_POST['lastname'])
&& tep_not_null($_POST['street_address'])) {
$process = true;
- if (ACCOUNT_GENDER == 'true') $gender =
tep_db_prepare_input($HTTP_POST_VARS['gender']);
- if (ACCOUNT_COMPANY == 'true') $company =
tep_db_prepare_input($HTTP_POST_VARS['company']);
- $firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
- $lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
- $street_address =
tep_db_prepare_input($HTTP_POST_VARS['street_address']);
- if (ACCOUNT_SUBURB == 'true') $suburb =
tep_db_prepare_input($HTTP_POST_VARS['suburb']);
- $postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
- $city = tep_db_prepare_input($HTTP_POST_VARS['city']);
- $country = tep_db_prepare_input($HTTP_POST_VARS['country']);
+ if (ACCOUNT_GENDER == 'true') $gender =
tep_db_prepare_input($_POST['gender']);
+ if (ACCOUNT_COMPANY == 'true') $company =
tep_db_prepare_input($_POST['company']);
+ $firstname = tep_db_prepare_input($_POST['firstname']);
+ $lastname = tep_db_prepare_input($_POST['lastname']);
+ $street_address = tep_db_prepare_input($_POST['street_address']);
+ if (ACCOUNT_SUBURB == 'true') $suburb =
tep_db_prepare_input($_POST['suburb']);
+ $postcode = tep_db_prepare_input($_POST['postcode']);
+ $city = tep_db_prepare_input($_POST['city']);
+ $country = tep_db_prepare_input($_POST['country']);
if (ACCOUNT_STATE == 'true') {
- if (isset($HTTP_POST_VARS['zone_id'])) {
- $zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
+ if (isset($_POST['zone_id'])) {
+ $zone_id = tep_db_prepare_input($_POST['zone_id']);
} else {
$zone_id = false;
}
- $state = tep_db_prepare_input($HTTP_POST_VARS['state']);
+ $state = tep_db_prepare_input($_POST['state']);
}
if (ACCOUNT_GENDER == 'true') {
@@ -133,7 +133,7 @@
}
if ($error == false) {
- $sql_data_array = array('customers_id' => $customer_id,
+ $sql_data_array = array('customers_id' => $osC_Customer->id,
'entry_firstname' => $firstname,
'entry_lastname' => $lastname,
'entry_street_address' => $street_address,
@@ -154,51 +154,49 @@
}
}
- if (!tep_session_is_registered('sendto'))
tep_session_register('sendto');
-
tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
- $sendto = tep_db_insert_id();
+ $osC_Session->set('sendto', tep_db_insert_id());
- if (tep_session_is_registered('shipping'))
tep_session_unregister('shipping');
+ $osC_Session->remove('shipping');
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
// process the selected shipping destination
- } elseif (isset($HTTP_POST_VARS['address'])) {
+ } elseif (isset($_POST['address'])) {
$reset_shipping = false;
- if (tep_session_is_registered('sendto')) {
- if ($sendto != $HTTP_POST_VARS['address']) {
- if (tep_session_is_registered('shipping')) {
+ if ($osC_Session->exists('sendto')) {
+ if ($osC_Session->value('sendto') != $_POST['address']) {
+ if ($osC_Session->exists('shipping')) {
$reset_shipping = true;
}
}
- } else {
- tep_session_register('sendto');
}
- $sendto = $HTTP_POST_VARS['address'];
+ $osC_Session->set('sendto', $_POST['address']);
- $check_address_query = tep_db_query("select count(*) as total from " .
TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and
address_book_id = '" . (int)$sendto . "'");
+ $check_address_query = tep_db_query("select count(*) as total from " .
TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$osC_Customer->id . "'
and address_book_id = '" . (int)$osC_Session->value('sendto') . "'");
$check_address = tep_db_fetch_array($check_address_query);
if ($check_address['total'] == '1') {
- if ($reset_shipping == true) tep_session_unregister('shipping');
+ if ($reset_shipping == true) {
+ $osC_Session->remove('shipping');
+ }
+
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
} else {
- tep_session_unregister('sendto');
+ $osC_Session->remove('sendto');
}
} else {
- if (!tep_session_is_registered('sendto')) tep_session_register('sendto');
- $sendto = $customer_default_address_id;
+ $osC_Session->set('sendto', $osC_Customer->default_address_id);
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
}
// if no shipping destination address was selected, use their own address as
default
- if (!tep_session_is_registered('sendto')) {
- $sendto = $customer_default_address_id;
+ if ($osC_Session->exists('sendto') == false) {
+ $osC_Session->set('sendto', $osC_Customer->default_address_id);
}
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING,
'', 'SSL'));
@@ -319,7 +317,7 @@
<tr>
<td class="main" align="center" valign="top"><?php echo
'<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES .
'arrow_south_east.gif'); ?></td>
<td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
- <td class="main" valign="top"><?php echo
tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td>
+ <td class="main" valign="top"><?php echo
tep_address_label($osC_Customer->id, $osC_Session->value('sendto'), true, ' ',
'<br>'); ?></td>
<td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
</tr>
</table></td>
@@ -354,7 +352,7 @@
<?php
$radio_buttons = 0;
- $addresses_query = tep_db_query("select address_book_id, entry_firstname
as firstname, entry_lastname as lastname, entry_company as company,
entry_street_address as street_address, entry_suburb as suburb, entry_city as
city, entry_postcode as postcode, entry_state as state, entry_zone_id as
zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where
customers_id = '" . (int)$customer_id . "'");
+ $addresses_query = tep_db_query("select address_book_id, entry_firstname
as firstname, entry_lastname as lastname, entry_company as company,
entry_street_address as street_address, entry_suburb as suburb, entry_city as
city, entry_postcode as postcode, entry_state as state, entry_zone_id as
zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where
customers_id = '" . (int)$osC_Customer->id . "'");
while ($addresses = tep_db_fetch_array($addresses_query)) {
$format_id = tep_get_address_format_id($addresses['country_id']);
?>
@@ -362,7 +360,7 @@
<td><?php echo tep_draw_separator('pixel_trans.gif', '10',
'1'); ?></td>
<td colspan="2"><table border="0" width="100%" cellspacing="0"
cellpadding="2">
<?php
- if ($addresses['address_book_id'] == $sendto) {
+ if ($addresses['address_book_id'] == $osC_Session->value('sendto')) {
echo ' <tr id="defaultSelected"
class="moduleRowSelected" onmouseover="rowOverEffect(this)"
onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' .
$radio_buttons . ')">' . "\n";
} else {
echo ' <tr class="moduleRow"
onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"
onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
@@ -370,7 +368,7 @@
?>
<td width="10"><?php echo
tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td class="main" colspan="2"><b><?php echo
tep_output_string_protected($addresses['firstname'] . ' ' .
$addresses['lastname']); ?></b></td>
- <td class="main" align="right"><?php echo
tep_draw_radio_field('address', $addresses['address_book_id'],
($addresses['address_book_id'] == $sendto)); ?></td>
+ <td class="main" align="right"><?php echo
tep_draw_radio_field('address', $addresses['address_book_id'],
($addresses['address_book_id'] == $osC_Session->value('sendto'))); ?></td>
<td width="10"><?php echo
tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
<tr>
Index: checkout_success.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/checkout_success.php,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- checkout_success.php 9 Jun 2003 23:03:53 -0000 1.49
+++ checkout_success.php 17 Nov 2003 20:58:34 -0000 1.50
@@ -13,13 +13,13 @@
require('includes/application_top.php');
// if the customer is not logged on, redirect them to the shopping cart page
- if (!tep_session_is_registered('customer_id')) {
+ if ($osC_Customer->isLoggedOn() == false) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
- if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] ==
'update')) {
+ if (isset($_GET['action']) && ($_GET['action'] == 'update')) {
$notify_string = 'action=notify&';
- $notify = $HTTP_POST_VARS['notify'];
+ $notify = (isset($_POST['notify']) ? $_POST['notify'] : array());
if (!is_array($notify)) $notify = array($notify);
for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
$notify_string .= 'notify[]=' . $notify[$i] . '&';
@@ -29,16 +29,16 @@
tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
}
- require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);
+ require(DIR_WS_LANGUAGES . $osC_Session->value('language') . '/' .
FILENAME_CHECKOUT_SUCCESS);
$breadcrumb->add(NAVBAR_TITLE_1);
$breadcrumb->add(NAVBAR_TITLE_2);
- $global_query = tep_db_query("select global_product_notifications from " .
TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id .
"'");
+ $global_query = tep_db_query("select global_product_notifications from " .
TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$osC_Customer->id
. "'");
$global = tep_db_fetch_array($global_query);
if ($global['global_product_notifications'] != '1') {
- $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . "
where customers_id = '" . (int)$customer_id . "' order by date_purchased desc
limit 1");
+ $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . "
where customers_id = '" . (int)$osC_Customer->id . "' order by date_purchased
desc limit 1");
$orders = tep_db_fetch_array($orders_query);
$products_array = array();
-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
|