Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fast Easy Checkout and checkout_shipping.php


ryanfc

Recommended Posts

Posted

I am using Fast Easy Checkout for my shopping cart and want to make a change to the checkout_shipping.php page. I want to combine the first 2 boxes on that page. The first box shows the products in the shopping cart and a total. The second box shows the shipping methods. Well for this shopping cart there is only 1 shipping method and cost. The shipping cost is 20% of the total. So what I want to do change where it currently says Total to Sub-Total, then place shipping cost below that and on a third line but the sub-total and shipping cost together for the real total. Then have the box where they choose payment method. Can anyone help me on how do combine these elements?

 

Here is the code for the page:

 

<?php
/*
$Id: checkout_shipping_express.php,v 1.16 2003/06/09 23:03:53 hpdl Exp $
redone by nana
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License

*/
require('includes/application_top.php');
require('includes/classes/http_client.php');

require(DIR_WS_LANGUAGES . $language . '/' . 'fast_account.php');



// 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;
} 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 = 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');
}
}
// 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;
} 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 = 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');
}
}


//the next 4 lines are for ccgv
require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;
/*$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check(); */
// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
// tep_redirect(tep_href_link('create_account1.php', '', 'SSL'));
// tep_redirect(tep_href_link('create_account2.php', '', 'SSL'));
// tep_redirect(tep_href_link('create_account3.php', '', 'SSL'));
tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
}
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
require(DIR_WS_CLASSES . 'payment.php');
$payment_modules = new payment;


$total_weight = $cart->show_weight();
$total_count = $cart->count_contents();


require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping;
// if there is nothing in the customers cart, redirect them to the shopping cart page
if ($cart->count_contents() < 1) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}

// 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;

// 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;
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
tep_session_unregister('billing');
tep_session_unregister('payment');
if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];
if (!tep_session_is_registered('payment')) tep_session_register('payment');



if($n==1){

if (isset($_POST['save_x'])){
$paynow=3;
}
if (isset($_POST['preview_x'])){
$paynow=5;
}


//i commented this out so payment is not required in this page and total can be accessed
/*if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
*/
tep_session_unregister('payment');
$payment_modules->update_status();
}
if (is_array($payment_modules->modules)) {
$payment_modules->pre_confirmation_check();
}
//}
while (list($key, $value) = each($_POST))
{
tep_session_register($key);
}
if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
$pass = false;

switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
case 'national':
if ($order->delivery['country_id'] == STORE_COUNTRY) {
$pass = true;
}
break;
case 'international':
if ($order->delivery['country_id'] != STORE_COUNTRY) {
$pass = true;
}
break;
case 'both':
$pass = true;
break;
}

$free_shipping = false;
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');
}
} 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 (!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'];

list($module, $method) = explode('_', $shipping);
if ( is_object($$module) || ($shipping == 'free_free') ) {
if ($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');
} 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']);

tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION,'paynow='.$paynow, 'SSL'));
}
}
} else {
tep_session_unregister('shipping');
}
}
} else {
$shipping = false;

tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, 'paynow='.$paynow, 'SSL'));
}
}

// get all available shipping quotes
$quotes = $shipping_modules->quote();

// if no shipping method has been selected, automatically select the cheapest method.
// 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();
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);
require(DIR_WS_LANGUAGES . $language . '/' . 'checkout_payment.php');


$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

<?php //echo $payment_modules->javascript_validation(); ?>
<script language="javascript"><!--
function ajaxLoader(url,id) {

 if (document.getElementById) {
var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
 }
 if (x) {

x.onreadystatechange = function() {
document.getElementById("contentLYR").innerHTML ='<img style="vertical-align:middle" src="images/loading.gif">Loading, please wait...';
  if (x.readyState == 4 && x.status == 200) {
	el = document.getElementById(id);
  el.innerHTML ="";
	el.innerHTML = x.responseText;

  }
}
x.open("GET", url, true);

x.send(null);

 }
}
var selected;

var zhipper='<?php echo $shipping['title']; ?>';
var Csid='<?php echo $osCsid; ?>';
var zprice='<?php echo $shipping['cost']; ?>';
var selected;

function selectRowEffect2(object, buttonSelect) {
 if (!selected) {
if (document.getElementById) {
  selected = document.getElementById('defaultSelected');
} else {
  selected = document.all['defaultSelected'];
}
 }

 if (selected) selected.className = 'moduleRow';
 object.className = 'moduleRowSelected2';
 selected = object;

// one button is not an array
 if (document.checkout_payment.shipping[0]) {
document.checkout_payment.shipping[buttonSelect].checked=true;
 } else {
document.checkout_payment.shipping.checked=true;
 }
}

function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
<script language="javascript"><!--
var selected;
<?php//rmh M-S_ccgv begin ?>
var submitter = null;
function submitFunction() {
  submitter = 1;
  }
<?php//rmh M-S_ccgv end ?>
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;
 }
}

function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table width="926" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
<td width="6" align="left" valign="top" background="../images/box/bottom_left.jpg"><img src="../images/box/bottom_left.jpg" width="6" height="409" /></td>
<td width="138" valign="top" bgcolor="#FFFFFF"><table id="navtablegreen" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td><a href="../index.php" onMouseOver="turnOn('home'); window.status='Home'; return true;" onMouseOut="turnOff('home'); window.status=document.title; return true"><img src="../images/navigation/home_off.gif" alt="Home" name="home" width="128" height="78" border="0" id="home" /></a></td>
  </tr>
  <tr>
	<td><a href="../workshops.php" onMouseOver="turnOn('workshops'); window.status='Workshops'; return true;" onMouseOut="turnOff('workshops'); window.status=document.title; return true"><img src="../images/navigation/workshops_off.gif" alt="Workshops" name="workshops" width="128" height="78" border="0" id="workshops" /></a></td>
  </tr>
  <tr>
	<td><a href="../services.php" onMouseOver="turnOn('services'); window.status='Services'; return true;" onMouseOut="turnOff('services'); window.status=document.title; return true"><img src="../images/navigation/services_off.gif" alt="Services" name="services" width="128" height="78" border="0" id="services" /></a></td>
  </tr>
  <tr>
	<td><a href="../librarians.php" onMouseOver="turnOn('librarians'); window.status='Librarians'; return true;" onMouseOut="turnOff('librarians'); window.status=document.title; return true"><img src="../images/navigation/librarians_off.gif" alt="Librarians" name="librarians" width="128" height="78" border="0" id="librarians" /></a></td>
  </tr>
  <tr>
	<td><a href="../materials.php" onMouseOver="turnOn('materials'); window.status='Materials'; return true;" onMouseOut="turnOff('materials'); window.status=document.title; return true"><img src="../images/navigation/materials_on.gif" alt="Materials" width="128" height="78" border="0" /></a></td>
  </tr>
  <tr>
	<td height="100%" align="left" valign="top"><img src="../images/spacer.gif" width="10" height="100%" /></td>
  </tr>
</table></td>
<!-- body_text //-->
<!-- body_text //-->
<td width="574" valign="top" bgcolor="#FFFFFF"><?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_SHIPPING, 'n=1', 'SSL'), 'post', 'onsubmit="return check_form();"') . tep_draw_hidden_field('action', 'process'); ?>
	<table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
			  <td class="pageHeading">Your Order</td>
			  <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_payment.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
			</tr>
		</table></td>
	  </tr>
	  <tr>
		<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())) {
?>
	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
			<tr>
			  <td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td>
			</tr>
		</table></td>
	  </tr>
	  <tr>
		<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice">
			<tr class="infoBoxNoticeContents">
			  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
				  <tr>
					<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					<td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>
					<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
			  </table></td>
			</tr>
		</table></td>
	  </tr>
	</table>
  <?php
 }
?>
</td>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr></tr>
</table></td>
 </tr>
 <?php	require('includes/fec/products_box.php');?>
 <?php	//require('includes/fec/comment_box.php');?>
 <?php	//require('includes/fec/shipping_box.php');?>
 <?php	require('includes/fec/ajax_shipping.php');?>
 <?php
$show_total = tep_db_prepare_input($HTTP_GET_VARS['show_total']);	
 if ($show_total ==1)		  require('includes/fec/total_box.php');?>
 <?php
// echo $order_total_modules->credit_selection();//rmh M-S_ccgv
?>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr  cellpadding="2">
<td  class="infoBox"><div id="contentLYR" align="right"  style="margin-right: 10px;"> </div></td>
 </tr>
 <noscript>
 <?php	  if ($show_total ==1)   require('total_box.php');?>
 </noscript>
 <?php	//require('includes/fec/address_box.php');?>
 <?php	require('includes/fec/payment_box.php');?>
 <tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  <tr class="infoBoxContents">
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		<td class="main"><b><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></b></td>
		<td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE,'name="preview" value="preview data"');  ?></td>
		<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
	  </tr>
	</table></td>
  </tr>
</table></td>
 </tr>
 <tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr>
<td><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></td>
 </tr>
</table>
</form>
</td>
<!-- body_text_eof //-->
<td width="202" align="right" valign="top" bgcolor="#FFFFFF"><table width="201%" border="0" cellpadding="0" cellspacing="0" class="sidebox">
  <tr>
	<td align="right" valign="top"><table class="sideboxtext" width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td width="19" align="left" valign="top"><img src="../images/stars/green_star.jpg" width="18" height="19" /></td>
		<td align="left" valign="middle"><a href="index.php?cPath=21">Picture Packet Pals</a></td>
	  </tr>
	  <tr>
		<td colspan="2" align="left" valign="top"><img src="../images/spacer.gif" width="10" height="6" /></td>
	  </tr>
	  <tr>
		<td align="left" valign="top"><img src="../images/stars/green_star.jpg" width="18" height="19" /></td>
		<td align="left" valign="middle"><a href="index.php?cPath=22">Velcro Storytelling Aprons</a></td>
	  </tr>
	  <tr>
		<td colspan="2" align="left" valign="top"><img src="../images/spacer.gif" width="10" height="6" /></td>
	  </tr>
	  <tr>
		<td align="left" valign="top"><img src="../images/stars/green_star.jpg" width="18" height="19" /></td>
		<td align="left" valign="middle"><a href="index.php?cPath=23">Metal Boards</a></td>
	  </tr>
	</table></td>
  </tr></table>
  <p> </p>
  <table border="0" width="202" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
<td width="6" align="left" valign="top" background="../images/box/bottom_right.jpg"><img src="../images/box/bottom_right.jpg" width="6" height="409" /></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html><?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

If you need to see any other code just let me know. Thank you for your help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...