Skip to content

Commit

Permalink
calculate time in sql query, easier to undestand; authored by gburton
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldpdl committed Jun 2, 2014
1 parent 2cc2f91 commit e9a8d17
Showing 1 changed file with 2 additions and 6 deletions.
Expand Up @@ -35,14 +35,10 @@ function execute() {
global $order_id;

if ( (int)MODULE_CONTENT_CHECKOUT_SUCCESS_REDIRECT_OLD_ORDER_MINUTES > 0 ) {
$check_query = tep_db_query("select date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
$check_query = tep_db_query("select 1 from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "' and date_purchased < date_sub(now(), interval '" . (int)MODULE_CONTENT_CHECKOUT_SUCCESS_REDIRECT_OLD_ORDER_MINUTES . "' minute)");

if ( tep_db_num_rows($check_query) ) {
$check = tep_db_fetch_array($check_query);

if ( strtotime($check['date_purchased'] . ' + ' . (int)MODULE_CONTENT_CHECKOUT_SUCCESS_REDIRECT_OLD_ORDER_MINUTES . ' minutes') < time() ) {
tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
}
tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
}
}
}
Expand Down

0 comments on commit e9a8d17

Please sign in to comment.