[TEP-COMMIT] [CVS catalog] the new checkout payment page based on a CSS layout, and the new payment
hpdl-OfajU3CKLf1/[email protected] 30 Mar 2005 00:08:22 -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_payment.php</span></a></tt></td><td align="right" id="added">+229</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/checkout_payment.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">payment.php</span></a></tt></td><td align="right" id="added">+105</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/checkout/payment.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td></td><td align="right" id="added">+334</td><td></td><td></td></tr>
</table>
<small id="info">2 added files</small><br />
<pre class="comment">
the new checkout payment page based on a CSS layout, and the new payment
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_payment.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/checkout_payment.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N checkout_payment.php
--- /dev/null Wed Mar 30 02:08:08 2005
+++ /tmp/cvsAAA7zaWI3 Wed Mar 30 02:08:17 2005
@@ -0,0 +1,229 @@
</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
+*/
+?>
+
+<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_payment.payment[0]) {
+ document.checkout_payment.payment[buttonSelect].checked=true;
+ } else {
+ document.checkout_payment.payment.checked=true;
+ }
+}
+//--></script>
+
+<?php echo $payment_modules->javascript_validation(); ?>
+
+<div class="pageHeading">
+ <span class="pageHeadingImage"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_payment.gif', HEADING_TITLE_CHECKOUT_PAYMENT, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></span>
+
+ <h1><?php echo HEADING_TITLE_CHECKOUT_PAYMENT; ?></h1>
+</div>
+
+<?php
+ if ($messageStack->size('checkout_payment') > 0) {
+ echo $messageStack->output('checkout_payment');
+ }
+?>
+
+<form name="checkout_payment" action="<?php echo tep_href_link(FILENAME_CHECKOUT, 'confirmation', 'SSL'); ?>" method="post" onsubmit="return check_form();">
+
+<?php
+ if (DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') {
+?>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo TABLE_HEADING_CONDITIONS; ?></div>
+
+ <div class="content">
+ <?php echo TEXT_CONDITIONS_DESCRIPTION . '<br><br>' . osc_draw_checkbox_field('conditions', '1', false, 'id="conditions"') . '<label for="conditions">&nbsp;' . TEXT_CONDITIONS_CONFIRM . '</label>'; ?>
+ </div>
+</div>
+
+<?php
+ }
+?>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo TABLE_HEADING_BILLING_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('billto'), true, ' ', '<br>'); ?>
+ </div>
+
+ <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;">
+ <?php echo '<b>' . TITLE_BILLING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?>
+ </div>
+
+ <?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>'; ?>
+ </div>
+</div>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></div>
+
+ <div class="content">
+
+<?php
+ $selection = $payment_modules->selection();
+
+ if (sizeof($selection) > 1) {
+?>
+
+ <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_PAYMENT_METHOD; ?></p>
+
+<?php
+ } else {
+?>
+
+ <p style="margin-top: 0px;"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></p>
+
+<?php
+ }
+?>
+
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+
+<?php
+ $radio_buttons = 0;
+ for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
+?>
+ <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 ( ($n == 1) || ($selection[$i]['id'] == $osC_Session->value('payment')) ) {
+ 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="3"><b><?php echo $selection[$i]['module']; ?></b></td>
+ <td class="main" align="right"><?php echo osc_draw_radio_field('payment', $selection[$i]['id'], $osC_Session->value('payment')); ?></td>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ </tr>
+<?php
+ if (isset($selection[$i]['error'])) {
+?>
+ <tr>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ <td class="main" colspan="4"><?php echo $selection[$i]['error']; ?></td>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ </tr>
+<?php
+ } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) {
+?>
+ <tr>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ <td colspan="4"><table border="0" cellspacing="0" cellpadding="2">
+<?php
+ for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {
+?>
+ <tr>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ <td class="main"><?php echo $selection[$i]['fields'][$j]['title']; ?></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ <td class="main"><?php echo $selection[$i]['fields'][$j]['field']; ?></td>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ </tr>
+<?php
+ }
+?>
+ </table></td>
+ <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ </tr>
+<?php
+ }
+?>
+ </table></td>
+ <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
+ </tr>
+<?php
+ $radio_buttons++;
+ }
+?>
+
+ </table>
+ </div>
+</div>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo TABLE_HEADING_COMMENTS; ?></div>
+
+ <div class="content">
+ <?php echo osc_draw_textarea_field('comments', ($osC_Session->exists('comments') ? $osC_Session->value('comments') : '')); ?>
+ </div>
+</div>
+
+<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_CONFIRMATION; ?>
+ </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_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
+ <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
+ </tr>
+ </table></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><?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%"><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="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
+ <td align="center" width="25%" class="checkoutBarCurrent"><?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>payment.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/checkout/payment.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N payment.php
--- /dev/null Wed Mar 30 02:08:18 2005
+++ /tmp/cvsAAAfWa4J3 Wed Mar 30 02:08:18 2005
@@ -0,0 +1,105 @@
</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_Payment {
+
+/* Public variables */
+
+ var $page_contents = 'checkout_payment.php';
+
+/* Private variables */
+
+ var $_module = 'payment';
+
+/* Class constructor */
+
+ function osC_Checkout_Payment() {
+ global $osC_Database, $osC_Session, $osC_Customer, $osC_Services, $breadcrumb, $cart, $total_weight, $total_count, $payment_modules;
+
+ if ($cart->count_contents() < 1) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL'));
+ }
+
+ if ($osC_Services->isStarted('breadcrumb')) {
+ $breadcrumb->add(NAVBAR_TITLE_CHECKOUT_PAYMENT, tep_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL'));
+ }
+
+// if no shipping method has been selected, redirect the customer to the shipping method selection page
+ 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) && $osC_Session->exists('cartID')) {
+ if ($cart->cartID != $osC_Session->value('cartID')) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
+ }
+ }
+
+// Stock Check
+ if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
+ $products = $cart->get_products();
+ for ($i=0, $n=sizeof($products); $i<$n; $i++) {
+ if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'SSL'));
+ break;
+ }
+ }
+ }
+
+// redirect to the billing address page when no default address exists
+ if ($osC_Customer->hasDefaultAddress() === false) {
+ $this->page_contents = 'payment_address.php';
+ }
+
+// if no billing destination address was selected, use the customers own address as default
+ if ($osC_Session->exists('billto') == false) {
+ $osC_Session->set('billto', $osC_Customer->default_address_id);
+ } else {
+// verify the selected billing 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('billto'));
+ $Qcheck->execute();
+
+ if ($Qcheck->valueInt('total') != 1) {
+ $osC_Session->set('billto', $osC_Customer->default_address_id);
+
+ $osC_Session->remove('payment');
+ }
+ }
+
+ $total_weight = $cart->show_weight();
+ $total_count = $cart->count_contents();
+
+// load all enabled payment modules
+ require(DIR_WS_CLASSES . 'payment.php');
+ $payment_modules = new payment;
+
+ if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) {
+ $messageStack->add('checkout_payment', $error['error'], 'error');
+ }
+ }
+
+/* Public methods */
+
+ function getPageContentsFile() {
+ return $this->page_contents;
+ }
+
+/* Private methods */
+
+ function _process() {
+ }
+ }
+?>
</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