[TEP-COMMIT] [CVS catalog] the new checkout shipping address page based on a CSS layout, and the new
hpdl-OfajU3CKLf1/[email protected] 30 Mar 2005 00:07:43 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>catalog/catalog/includes</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt>content/pages/<a href="#file1"><span id="added">checkout_shipping_address.php</span></a></tt></td><td align="right" id="added">+217</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/checkout_shipping_address.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>modules/checkout/<a href="#file2"><span id="added">shipping_address.php</span></a></tt></td><td align="right" id="added">+246</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/checkout/shipping_address.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td></td><td align="right" id="added">+463</td><td></td><td></td></tr>
</table>
<small id="info">2 added files</small><br />
<pre class="comment">
the new checkout shipping address page based on a CSS layout, and the new
shipping address checkout module to handle the processing logic
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content">content</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages">pages</a><br /></span>
<div class="fileheader" id="added"><big><b>checkout_shipping_address.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/checkout_shipping_address.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N checkout_shipping_address.php
--- /dev/null Wed Mar 30 02:07:34 2005
+++ /tmp/cvsAAAujaqk3 Wed Mar 30 02:07:39 2005
@@ -0,0 +1,217 @@
</small></pre><pre class="diff" id="added">+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2005 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ $addresses_count = tep_count_customer_address_book_entries();
+?>
+
+<script language="javascript"><!--
+var selected;
+
+function selectRowEffect(object, buttonSelect) {
+ if (!selected) {
+ if (document.getElementById) {
+ selected = document.getElementById('defaultSelected');
+ } else {
+ selected = document.all['defaultSelected'];
+ }
+ }
+
+ if (selected) selected.className = 'moduleRow';
+ object.className = 'moduleRowSelected';
+ selected = object;
+
+// one button is not an array
+ if (document.checkout_address.address[0]) {
+ document.checkout_address.address[buttonSelect].checked=true;
+ } else {
+ document.checkout_address.address.checked=true;
+ }
+}
+
+function check_form_optional(form_name) {
+ var form = form_name;
+
+ var firstname = form.elements['firstname'].value;
+ var lastname = form.elements['lastname'].value;
+ var street_address = form.elements['street_address'].value;
+
+ if (firstname == '' && lastname == '' && street_address == '') {
+ return true;
+ } else {
+ return check_form(form_name);
+ }
+}
+//--></script>
+
+<?php require('includes/form_check.js.php'); ?>
+
+<div class="pageHeading">
+ <span class="pageHeadingImage"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE_CHECKOUT_SHIPPING_ADDRESS, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></span>
+
+ <h1><?php echo HEADING_TITLE_CHECKOUT_SHIPPING_ADDRESS; ?></h1>
+</div>
+
+<?php
+ if ($messageStack->size('checkout_address') > 0) {
+ echo $messageStack->output('checkout_address');
+ }
+?>
+
+<form name="checkout_address" action="<?php echo tep_href_link(FILENAME_CHECKOUT, 'shipping_address=process', 'SSL'); ?>" method="post" onSubmit="return check_form_optional(checkout_address);">
+
+<?php
+ if ($_GET['shipping_address'] != 'process') {
+ if ($osC_Customer->hasDefaultAddress() === true) {
+?>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></div>
+
+ <div class="content">
+ <div style="float: right; padding: 0px 0px 10px 20px;">
+ <?php echo tep_address_label($osC_Customer->id, $osC_Session->value('sendto'), true, ' ', '<br>'); ?>
+ </div>
+
+ <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;">
+ <?php echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?>
+ </div>
+
+ <?php echo TEXT_SELECTED_SHIPPING_DESTINATION; ?>
+ </div>
+</div>
+
+<?php
+ }
+
+ if ($addresses_count > 1) {
+?>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES; ?></div>
+
+ <div class="content">
+ <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;">
+ <?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?>
+ </div>
+
+ <p style="margin-top: 0px;"><?php echo TEXT_SELECT_OTHER_SHIPPING_DESTINATION; ?></p>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+
+<?php
+ $radio_buttons = 0;
+
+ $Qaddresses = $osC_Database->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 = :customers_id');
+ $Qaddresses->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+ $Qaddresses->bindInt(':customers_id', $osC_Customer->id);
+ $Qaddresses->execute();
+
+ while ($Qaddresses->next()) {
+ $format_id = tep_get_address_format_id($Qaddresses->valueInt('country_id'));
+?>
+ <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 ($Qaddresses->valueInt('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";
+ }
+?>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ <td class="main" colspan="2"><b><?php echo $Qaddresses->valueProtected('firstname') . ' ' . $Qaddresses->valueProtected('lastname'); ?></b></td>
+ <td class="main" align="right"><?php echo osc_draw_radio_field('address', $Qaddresses->valueInt('address_book_id'), $osC_Session->value('sendto')); ?></td>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ </tr>
+ <tr>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ <td colspan="3"><table border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ <td class="main"><?php echo tep_address_format($format_id, $Qaddresses->toArray(), true, ' ', ', '); ?></td>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ </tr>
+ </table></td>
+ <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>
+ </tr>
+<?php
+ $radio_buttons++;
+ }
+?>
+
+ </table>
+ </div>
+</div>
+
+<?php
+ }
+ }
+
+ if ($addresses_count < MAX_ADDRESS_BOOK_ENTRIES) {
+?>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo TABLE_HEADING_NEW_SHIPPING_ADDRESS; ?></div>
+
+ <div class="content">
+ <?php echo TEXT_CREATE_NEW_SHIPPING_ADDRESS; ?>
+
+ <div style="margin: 10px 30px 10px 30px;">
+ <?php require('includes/modules/checkout_new_address.php'); ?>
+ </div>
+ </div>
+</div>
+
+<?php
+ }
+?>
+
+<div class="moduleBox">
+ <div class="content">
+ <div style="float: right;">
+ <?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?>
+ </div>
+
+ <?php echo '<b>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE_TO_SHIPPING; ?>
+ </div>
+</div>
+
+<table border="0" width="100%" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="50%" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
+ <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
+ </tr>
+ </table></td>
+ <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
+ <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
+ <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
+ <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
+ </tr>
+ </table></td>
+ </tr>
+ <tr>
+ <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
+ <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
+ <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
+ <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
+ </tr>
+</table>
+
+</form>
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules">modules</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/checkout">checkout</a><br /></span>
<div class="fileheader" id="added"><big><b>shipping_address.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/checkout/shipping_address.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N shipping_address.php
--- /dev/null Wed Mar 30 02:07:34 2005
+++ /tmp/cvsAAAJsayl3 Wed Mar 30 02:07:39 2005
@@ -0,0 +1,246 @@
</small></pre><pre class="diff" id="added">+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2005 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Checkout_Shipping_address {
+
+/* Public variables */
+
+ var $page_contents = 'checkout_shipping_address.php';
+
+/* Private variables */
+
+ var $_module = 'shipping_address';
+
+/* Class constructor */
+
+ function osC_Checkout_Shipping_address() {
+ global $osC_Session, $osC_Services, $breadcrumb, $cart, $order;
+
+ if ($cart->count_contents() < 1) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL'));
+ }
+
+ $order = new order();
+
+// 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') {
+ $osC_Session->set('shipping'. false);
+ $osC_Session->set('sendto', false);
+
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
+ }
+
+// if no shipping destination address was selected, use their own address as default
+ if ($osC_Session->exists('sendto') == false) {
+ $osC_Session->set('sendto', $osC_Customer->default_address_id);
+ }
+
+ if ($osC_Services->isStarted('breadcrumb')) {
+ $breadcrumb->add(NAVBAR_TITLE_CHECKOUT_SHIPPING, tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
+ $breadcrumb->add(NAVBAR_TITLE_CHECKOUT_SHIPPING_ADDRESS, tep_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL'));
+ }
+
+ if (($_GET[$this->_module] == 'process')) {
+ $this->_process();
+ }
+ }
+
+/* Public methods */
+
+ function getPageContentsFile() {
+ return $this->page_contents;
+ }
+
+/* Private methods */
+
+ function _process() {
+ global $osC_Database, $osC_Session, $osC_Customer, $messageStack;
+
+// process a new shipping address
+ if (($osC_Customer->hasDefaultAddress() === false) || (tep_not_null($_POST['firstname']) && tep_not_null($_POST['lastname']) && tep_not_null($_POST['street_address'])) ) {
+ if (ACCOUNT_GENDER > 0) {
+ if (!isset($_POST['gender']) || (($_POST['gender'] != 'm') && ($_POST['gender'] != 'f'))) {
+ $messageStack->add('checkout_address', ENTRY_GENDER_ERROR);
+ }
+ }
+
+ if (!isset($_POST['firstname']) || (strlen(trim($_POST['firstname'])) < ACCOUNT_FIRST_NAME)) {
+ $messageStack->add('checkout_address', ENTRY_FIRST_NAME_ERROR);
+ }
+
+ if (!isset($_POST['lastname']) || (strlen(trim($_POST['lastname'])) < ACCOUNT_LAST_NAME)) {
+ $messageStack->add('checkout_address', ENTRY_LAST_NAME_ERROR);
+ }
+
+ if (ACCOUNT_COMPANY > 0) {
+ if (!isset($_POST['company']) || (strlen(trim($_POST['company'])) < ACCOUNT_COMPANY)) {
+ $messageStack->add('checkout_address', ENTRY_COMPANY_ERROR);
+ }
+ }
+
+ if (!isset($_POST['street_address']) || (strlen(trim($_POST['street_address'])) < ACCOUNT_STREET_ADDRESS)) {
+ $messageStack->add('checkout_address', ENTRY_STREET_ADDRESS_ERROR);
+ }
+
+ if (ACCOUNT_SUBURB > 0) {
+ if (!isset($_POST['suburb']) || (strlen(trim($_POST['suburb'])) < ACCOUNT_SUBURB)) {
+ $messageStack->add('checkout_address', ENTRY_SUBURB_ERROR);
+ }
+ }
+
+ if (!isset($_POST['postcode']) || (strlen(trim($_POST['postcode'])) < ACCOUNT_POST_CODE)) {
+ $messageStack->add('checkout_address', ENTRY_POST_CODE_ERROR);
+ }
+
+ if (!isset($_POST['city']) || (strlen(trim($_POST['city'])) < ACCOUNT_CITY)) {
+ $messageStack->add('checkout_address', ENTRY_CITY_ERROR);
+ }
+
+ if (ACCOUNT_STATE > 0) {
+ $zone_id = 0;
+
+ $Qcheck = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id limit 1');
+ $Qcheck->bindTable(':table_zones', TABLE_ZONES);
+ $Qcheck->bindInt(':zone_country_id', $_POST['country']);
+ $Qcheck->execute();
+
+ $entry_state_has_zones = ($Qcheck->numberOfRows() > 0);
+
+ $Qcheck->freeResult();
+
+ if ($entry_state_has_zones === true) {
+ $Qzone = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_code like :zone_code');
+ $Qzone->bindTable(':table_zones', TABLE_ZONES);
+ $Qzone->bindInt(':zone_country_id', $_POST['country']);
+ $Qzone->bindValue(':zone_code', $_POST['state']);
+ $Qzone->execute();
+
+ if ($Qzone->numberOfRows() === 1) {
+ $zone_id = $Qzone->valueInt('zone_id');
+ } else {
+ $Qzone = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_name like :zone_name');
+ $Qzone->bindTable(':table_zones', TABLE_ZONES);
+ $Qzone->bindInt(':zone_country_id', $_POST['country']);
+ $Qzone->bindValue(':zone_name', $_POST['state'] . '%');
+ $Qzone->execute();
+
+ if ($Qzone->numberOfRows() === 1) {
+ $zone_id = $Qzone->valueInt('zone_id');
+ } else {
+ $messageStack->add('checkout_address', ENTRY_STATE_ERROR_SELECT);
+ }
+ }
+
+ $Qzone->freeResult();
+ } else {
+ if (strlen(trim($_POST['state'])) < ACCOUNT_STATE) {
+ $messageStack->add('checkout_address', ENTRY_STATE_ERROR);
+ }
+ }
+ }
+
+ if ( (is_numeric($_POST['country']) === false) || ($_POST['country'] < 1) ) {
+ $messageStack->add('checkout_address', ENTRY_COUNTRY_ERROR);
+ }
+
+ if (ACCOUNT_TELEPHONE > 0) {
+ if (!isset($_POST['telephone']) || (strlen(trim($_POST['telephone'])) < ACCOUNT_TELEPHONE)) {
+ $messageStack->add('checkout_address', ENTRY_TELEPHONE_NUMBER_ERROR);
+ }
+ }
+
+ if (ACCOUNT_FAX > 0) {
+ if (!isset($_POST['fax']) || (strlen(trim($_POST['fax'])) < ACCOUNT_FAX)) {
+ $messageStack->add('checkout_address', ENTRY_FAX_NUMBER_ERROR);
+ }
+ }
+
+ if ($messageStack->size('checkout_address') === 0) {
+ $Qab = $osC_Database->query('insert into :table_address_book (customers_id, entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_country_id, entry_zone_id, entry_telephone, entry_fax) values (:customers_id, :entry_gender, :entry_company, :entry_firstname, :entry_lastname, :entry_street_address, :entry_suburb, :entry_postcode, :entry_city, :entry_state, :entry_country_id, :entry_zone_id, :entry_telephone, :entry_fax)');
+ $Qab->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+ $Qab->bindInt(':customers_id', $osC_Customer->id);
+ $Qab->bindValue(':entry_gender', (((ACCOUNT_GENDER > -1) && isset($_POST['gender']) && (($_POST['gender'] == 'm') || ($_POST['gender'] == 'f'))) ? $_POST['gender'] : ''));
+ $Qab->bindValue(':entry_company', ((ACCOUNT_COMPANY > -1) ? trim($_POST['company']) : ''));
+ $Qab->bindValue(':entry_firstname', trim($_POST['firstname']));
+ $Qab->bindValue(':entry_lastname', trim($_POST['lastname']));
+ $Qab->bindValue(':entry_street_address', trim($_POST['street_address']));
+ $Qab->bindValue(':entry_suburb', ((ACCOUNT_SUBURB > -1) ? trim($_POST['suburb']) : ''));
+ $Qab->bindValue(':entry_postcode', trim($_POST['postcode']));
+ $Qab->bindValue(':entry_city', trim($_POST['city']));
+ $Qab->bindValue(':entry_state', ((ACCOUNT_STATE > -1) ? (($zone_id > 0) ? '' : trim($_POST['state'])) : ''));
+ $Qab->bindInt(':entry_country_id', $_POST['country']);
+ $Qab->bindInt(':entry_zone_id', ((ACCOUNT_STATE > -1) ? (($zone_id > 0) ? $zone_id : 0) : ''));
+ $Qab->bindValue(':entry_telephone', ((ACCOUNT_TELEPHONE > -1) ? trim($_POST['telephone']) : ''));
+ $Qab->bindValue(':entry_fax', ((ACCOUNT_FAX > -1) ? trim($_POST['fax']) : ''));
+ $Qab->execute();
+
+ if ($Qab->affectedRows() === 1) {
+ $address_book_id = $osC_Database->nextID();
+
+ if ($osC_Customer->hasDefaultAddress() === false) {
+ $Qcustomer = $osC_Database->query('update :table_customers set customers_default_address_id = :customers_default_address_id where customers_id = :customers_id');
+ $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS);
+ $Qcustomer->bindInt(':customers_default_address_id', $address_book_id);
+ $Qcustomer->bindInt(':customers_id', $osC_Customer->id);
+ $Qcustomer->execute();
+
+ $osC_Customer->setCountryID($_POST['country']);
+ $osC_Customer->setZoneID($zone_id);
+ $osC_Customer->setDefaultAddressID($address_book_id);
+ }
+
+ $osC_Session->set('sendto', $address_book_id);
+ $osC_Session->remove('shipping');
+
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
+ } else {
+ $messageStack->add('checkout_address', 'Error inserting into address book table.');
+ }
+ }
+// process the selected shipping destination
+ } elseif (isset($_POST['address'])) {
+ $reset_shipping = false;
+
+ if ($osC_Session->exists('sendto')) {
+ if ($osC_Session->value('sendto') != $_POST['address']) {
+ if ($osC_Session->exists('shipping')) {
+ $reset_shipping = true;
+ }
+ }
+ }
+
+ $osC_Session->set('sendto', $_POST['address']);
+
+ $Qcheck = $osC_Database->query('select count(*) as total from :table_address_book where customers_id = :customers_id and address_book_id = :address_book_id');
+ $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+ $Qcheck->bindInt(':customers_id', $osC_Customer->id);
+ $Qcheck->bindInt(':address_book_id', $osC_Session->value('sendto'));
+ $Qcheck->execute();
+
+ if ($Qcheck->valueInt('total') == 1) {
+ if ($reset_shipping == true) {
+ $osC_Session->remove('shipping');
+ }
+
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
+ } else {
+ $osC_Session->remove('sendto');
+ }
+ } else {
+ $osC_Session->set('sendto', $osC_Customer->default_address_id);
+
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
+ }
+ }
+ }
+?>
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.9</small></center>
</body></html>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click