Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

OSCommerce - Redirect to navigation snapshot doesn't work


Pelvis

Recommended Posts

I use OSCommerce v2.2 and what I want is when the user visits a page that redirects him to login after a successful login to be redirected to the page that initially visited.

For example, the user receives an email that prompts him to visit the page review.php he clicks the page and gets redirect to login.php. After the login I want him to be redirected to review.php

OSCommerce seems to have this functionality at login.php

if (sizeof($navigation->snapshot) > 0) {
  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
  $navigation->clear_snapshot();
  tep_redirect($origin_href);
} else {
  tep_redirect(tep_href_link(FILENAME_DEFAULT));
}

And at the review.php file, the snapshot is set when the user is not logged in.

$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

but then in application_top.php the following code seems to destroy the navigation snapshot

// navigation history
  if (tep_session_is_registered('navigation')) {
    if (PHP_VERSION < 4) {
      $broken_navigation = $navigation;
      $navigation = new navigationHistory;
      $navigation->unserialize($broken_navigation);
    }
  } else {
    tep_session_register('navigation');
    $navigation = new navigationHistory;
  }
  $navigation->add_current_page();

So before I fix this with my own session variables I would like to use the implemented functionality. Has anyone experienced the same problem and came up with a solution to the default functionality?

P.S The PHP version of the site is 7.2

Thanks for your time :-)

Link to comment
Share on other sites

Will removal of the nested if help? As follows:

Quote

// navigation history
  if (!tep_session_is_registered('navigation')) {
    tep_session_register('navigation');
    $navigation = new navigationHistory;
  }
  $navigation->add_current_page();

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...