Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Checkout_success.php - Need some tips on adding more order info


Guest

Recommended Posts

Hello.

 

I posted the same question/issue in "instalation" but to date no one has replied. If I am "asking the wrong way: then feel free to correct me-I am not a regular poster so I am unsure about the process but hoping somebody will at least reply:)

 

I am trying to have the "checkout_success.php" page AUTOMATICALLY redirect to the cutomer's account showing the SUCCESSFUL ORDER NUMBER so that the cutomer immediately knows his order number etc.

:'(

Please note that before posting this question I have spent a lot of time researching this issue myself in the forums as well as the contributions but I don't think that I have found the "exact answer" thus as am hoping one of you can help.

 

When an order goes through, mine says "Your Order Has Been Processed!", "Thanks for shopping with us online!" a "continue button".

 

INSTEAD OF THIS, what I NEED TO DO, is AT LEAST show the ORDER NUMBER on the Checkout_success.php page. HOWEVER IF POSSIBLE, I would prefer to show the ENTIRE INVOICE on this page. Right now, as I think is standard, the cutomer needs to press "continue", then click "order history" to see the order/invoice and to get the "invoice/order number. This is NOT intuitive, in my opinion.

 

I was going to try a java script redirect in the checkout_success.php page to "account.php" however this is not really the "best solution", rather one I know how to implememt. I would prefer something better.

 

Some of the contributions that I "came up with" that "MAY" fix this (Not sure-this is where I could use your advice????) are:

 

1) Improved Order Number

2) Customer View & Print Invoice at Checkout Succes

3) Customer View & Print Invoice at Checkout Succes

 

After researching these contributions, it is still unclear if any of them will really do what I want-which is to substantially alter the checkout_success.php page.

 

If this subject has been covered elsewhere any help or guidance or ALTERNATIVE SOLUTIONS would be GREATLY appreciated. Again, to date NO ONE has replied to this issue. If I am "asking the wrong way: then feel free to correct me-I am not a regular poster. Thank you in advance.

 

Kind Regards,

DavidK111

Link to comment
Share on other sites

Here's the Code I implemented, it works, but it could definitely be "better". Basically what I did to make this work was paste the info code from acount.php into a new table I created in checkout_success.php. I tested it and it seems to work.

 

 

 

I have highlighted the PASTE IN BLUE.

 

 

 

Anyone have any "cleaner" solutions? Thanks in advance!

 

 

 

 

 

<?php

/*

$Id: checkout_success.php,v 1.49 2003/06/09 23:03:53 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

 

if (!tep_session_is_registered('customer_id')) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {

$notify_string = 'action=notify&';

$notify = $HTTP_POST_VARS['notify'];

if (!is_array($notify)) $notify = array($notify);

for ($i=0, $n=sizeof($notify); $i<$n; $i++) {

$notify_string .= 'notify[]=' . $notify[$i] . '&';

}

if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);

 

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));

}

 

require(DIR_WS_LANGUAGES . $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 = 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 = tep_db_fetch_array($orders_query);

 

$products_array = array();

$products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name");

while ($products = tep_db_fetch_array($products_query)) {

$products_array[] = array('id' => $products['products_id'],

'text' => $products['products_name']);

}

}

?>

<!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">

</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 border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('order', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="4" cellpadding="2">

<tr>

<td valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE); ?></td>

<td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo HEADING_TITLE; ?></div><br><?php echo TEXT_SUCCESS; ?><br><br>

<?php

if ($global['global_product_notifications'] != '1') {

echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';

 

$products_displayed = array();

for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {

if (!in_array($products_array[$i]['id'], $products_displayed)) {

echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';

$products_displayed[] = $products_array[$i]['id'];

}

}

 

echo '</p>';

} else {

echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;

}

?>

<h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>

</tr>

</table>

 

<p><table border="2" width="100%" cellspacing="0" cellpadding="2">

/*

BEGIN New Paste By DavidK111

*/

 

<?php

$orders_query = tep_db_query("select o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by orders_id desc limit 3");

while ($orders = tep_db_fetch_array($orders_query)) {

if (tep_not_null($orders['delivery_name'])) {

$order_name = $orders['delivery_name'];

$order_country = $orders['delivery_country'];

} else {

$order_name = $orders['billing_name'];

$order_country = $orders['billing_country'];

}

?>

<tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL'); ?>'">

<td class="main" width="80"><?php echo tep_date_short($orders['date_purchased']); ?></td>

<td class="main"><?php echo '#' . $orders['orders_id']; ?></td>

<td class="main"><?php echo tep_output_string_protected($order_name) . ', ' . $order_country; ?></td>

<td class="main"><?php echo $orders['orders_status_name']; ?></td>

<td class="main" align="right"><?php echo $orders['order_total']; ?></td>

<td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td>

</tr>

<?php

}

?>

/*

END New Paste By DavidK111

*/

 

 

 

</table>

<p> </p> </p></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></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%"><?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_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>

<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>

<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>

<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_FINISHED; ?></td>

</tr>

</table></td>

</tr>

<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></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'); ?>

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...