| [ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: checkout_success.php 3 2006-05-27 04:59:07Z user $ 4 5 osCMax Power E-Commerce 6 http://oscdox.com 7 8 Copyright 2006 osCMax 9 10 Released under the GNU General Public License 11 */ 12 13 // Most of this file is changed or moved to BTS - Basic Template System - format. 14 // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change). 15 // catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change). 16 // (Sub 'fallback' with your current template to see if there is a template specific file.) 17 18 require ('includes/application_top.php'); 19 20 // if the customer is not logged on, redirect them to the shopping cart page 21 if (!tep_session_is_registered('customer_id')) { 22 tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); 23 } 24 25 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) { 26 $notify_string = ''; 27 28 if (isset($HTTP_POST_VARS['notify']) && !empty($HTTP_POST_VARS['notify'])) { 29 $notify = $HTTP_POST_VARS['notify']; 30 31 if (!is_array($notify)) { 32 $notify = array($notify); 33 } 34 35 for ($i=0, $n=sizeof($notify); $i<$n; $i++) { 36 if (is_numeric($notify[$i])) { 37 $notify_string .= 'notify[]=' . $notify[$i] . '&'; 38 } 39 } 40 } 41 42 // BOF: 43 // tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string)); 44 // Added a check for a Guest checkout and cleared the session - 030411 45 if (tep_session_is_registered('noaccount')) { 46 tep_session_destroy(); 47 tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL')); 48 } else { 49 tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string, 'SSL')); 50 } 51 // EOF: 52 } 53 54 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS); 55 56 $breadcrumb->add(NAVBAR_TITLE_1); 57 // $breadcrumb->add(NAVBAR_TITLE_2); //Removed for PWA 0.8 58 59 $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'"); 60 $global = tep_db_fetch_array($global_query); 61 62 if ($global['global_product_notifications'] != '1') { 63 $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1"); 64 $orders = tep_db_fetch_array($orders_query); 65 66 $products_array = array(); 67 $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"); 68 while ($products = tep_db_fetch_array($products_query)) { 69 $products_array[] = array('id' => $products['products_id'], 70 'text' => $products['products_name']); 71 } 72 } 73 74 // BOF: MOD - PWA: Added a check for a Guest checkout and cleared the session - 030411 v0.71 75 if (tep_session_is_registered('noaccount')) { 76 $order_update = array('purchased_without_account' => '1'); 77 tep_db_perform(TABLE_ORDERS, $order_update, 'update', "orders_id = '".$orders['orders_id']."'"); 78 // tep_db_query("insert into " . TABLE_ORDERS . " (purchased_without_account) values ('1') where orders_id = '" . (int)$orders['orders_id'] . "'"); 79 tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . tep_db_input($customer_id) . "'"); 80 tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . tep_db_input($customer_id) . "'"); 81 tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . tep_db_input($customer_id) . "'"); 82 tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . tep_db_input($customer_id) . "'"); 83 tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . tep_db_input($customer_id) . "'"); 84 tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . tep_db_input($customer_id) . "'"); 85 tep_session_destroy(); 86 87 // BOF: Bugfix 0000062 88 // OK, so this was a PWA, so lets check for other MIA PWA accounts, and clear them as well!! 89 $old_customers_query = tep_db_query("select c.customers_id, c.purchased_without_account as pwa, ci.customers_info_date_account_created as date from " . TABLE_CUSTOMERS_INFO . " ci left join " . TABLE_CUSTOMERS . " c on ci.customers_info_id = c.customers_id"); 90 while ($old_customer = tep_db_fetch_array($old_customers_query)) { 91 //the second and third part of this if statement should be moved into the mysql select as a where clause... 92 if ((!tep_session_is_registered($old_customer['customers_id'])) && //dont't want to delete PWA accounts with registered sessions... 93 ((strtotime($old_customer['date']) + (60*60)) < time()) && //make sure the MIA PWA account is at least an hour old (is this old enough? ...its worked well for me so far... a session is 24 minutes, so I figure its safe) 94 ($old_customer['pwa'] == 1) ) { //Oh, and make sure it IS a PWA... 95 //Then delete it like we did above... might be able to compact this code, but... 96 tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $old_customer['customers_id'] . "'"); 97 tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . $old_customer['customers_id'] . "'"); 98 tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $old_customer['customers_id'] . "'"); 99 tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $old_customer['customers_id'] . "'"); 100 tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $old_customer['customers_id'] . "'"); 101 tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . $old_customer['customers_id'] . "'"); 102 } 103 } 104 // EOF: Bugfix 0000062 105 } 106 // EOF: MOD - PWA: Added a check for a Guest checkout and cleared the session - 030411 v0.71 107 108 $content = CONTENT_CHECKOUT_SUCCESS; 109 110 include (bts_select('main', $content_template)); // BTSv1.5 111 112 require (DIR_WS_INCLUDES . 'application_bottom.php'); 113 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |