Skip to content

Figured I should share the changes I once made #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 63 additions & 61 deletions checkout_success.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,59 @@
Released under the GNU General Public License
*/

require('includes/application_top.php');
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 (!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')) {
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {
$notify_string = '';

if (isset($HTTP_POST_VARS['notify']) && !empty($HTTP_POST_VARS['notify'])) {
$notify = $HTTP_POST_VARS['notify'];
$notify = $HTTP_POST_VARS['notify'];

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

for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
if (is_numeric($notify[$i])) {
$notify_string .= 'notify[]=' . $notify[$i] . '&';
for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
if (is_numeric($notify[$i])) {
$notify_string .= 'notify[]=' . $notify[$i] . '&';
}
}
}

if (!empty($notify_string)) {
$notify_string = 'action=notify&' . substr($notify_string, 0, -1);
}
if (!empty($notify_string)) {
$notify_string = 'action=notify&' . substr($notify_string, 0, -1);
}
}

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
}
}

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);

$breadcrumb->add(NAVBAR_TITLE_1);
$breadcrumb->add(NAVBAR_TITLE_2);
$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);
$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 * from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");
if ($global['global_product_notifications'] != '1') {
$orders_query = tep_db_query("select orders_id, payment_method 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']);
$products_array[] = array('id' => $products['products_id'],
'text' => $products['products_name']);
}
}
}

require(DIR_WS_INCLUDES . 'template_top.php');
require(DIR_WS_INCLUDES . 'template_top.php');
?>

<h1><?php echo HEADING_TITLE; ?></h1>
Expand All @@ -70,43 +71,44 @@

<div class="contentContainer">
<div class="contentText">
<?php
if( $orders['payment_method'] == "Bitcoin Payment" ) {
$amount_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$orders['orders_id'] . "' and class = 'ot_total'");
$payment_amount = tep_db_fetch_array($amount_query);
$payment_address_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$orders['orders_id'] . "'");
$payment_address = tep_db_fetch_array($payment_address_query);
preg_match('/(1[0-9a-zA-Z]{25,})/s',$payment_address['comments'],&$matches);
if( $matches[0] ) {
$payment_address = $matches[0];
} else {
$payment_address = "(Error: please check your invoice under My Accounts for the payment address)";
}
echo "To complete your order please send " . $payment_amount['text']. " to " . $payment_address . "<br /><br />";
}
?>
<?php echo TEXT_SUCCESS; ?>
<?php
if($orders['payment_method'] == "Bitcoin Payment") {
$amount_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$orders['orders_id'] . "' and class = 'ot_total'");
$payment_amount = tep_db_fetch_array($amount_query);
$payment_address_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$orders['orders_id'] . "'");
$payment_address = tep_db_fetch_array($payment_address_query);

preg_match('/(1[0-9a-zA-Z]{25,})/s',$payment_address['comments'],$matches);
if($matches[0]) {
$payment_address = $matches[0];
} else {
$payment_address = "(Error: please check your invoice under My Accounts for the payment address)";
}
echo "To complete your order please send " . $payment_amount['text']. " to " . $payment_address . "<br /><br />";
}

echo TEXT_SUCCESS;
?>
</div>

<div class="contentText">

<?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'];
}
}
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>';
}
echo '</p>';
}

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

</div>
Expand All @@ -116,9 +118,9 @@
</div>

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

<div class="buttonSet">
Expand All @@ -129,6 +131,6 @@
</form>

<?php
require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Loading