Contributions
Login and Return to same page
This allows User's to log in and return to the page they were asked to login for, not being sent back to index.php
Open application top paste at bottom before ?>
// if the customer is not logged on, set the page to return to upon login
if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) != FILENAME_LOGOFF) && (!strstr($PHP_SELF,'create')) && (!strstr($PHP_SELF,'popup')) {
$navigation->set_snapshot();
}
**************************************
Open Logout.php
Place anywhere
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();
$link = $origin_href;
} else {
$link = tep_href_link(FILENAME_DEFAULT);
}
******************
Thats all
Expand All / Collapse All
[EN]
I tried all the options and none work as needed.
Problems:
1 - the client is identified with nothing in the car... why you have to show the empty car? why not go to the front of the store?
2 - the client is identified having items in the cart... because he has to send the cover of the tent? why not go on the buying process?
The solution here: http://forums.oscommerce.com/topic/237743-login-redirect-to-index-instead-of-previous-page/page__view__findpost__p__1580435
[ES]
He probado todas las opciones y no funciona como es necesario.
Problemas:
1 - el cliente se identifica con el carrito vacío ... ¿por qué tiene que mostrarse el carrito vacío? ¿por qué no se muestra la portada de la tienda?
2 - el cliente se identifica con productos en el carrito... ¿porque se le tiene que enviar la portada de la tienda? ¿por qué no ir al proceso de compra?
La solución aqui: http://forums.oscommerce.com/topic/237743-login-redirect-to-index-instead-of-previous-page/page__view__findpost__p__1580435
reflex-ocasion
Please read this post as this contribute is not a good solution
http://forums.oscommerce.com/topic/237743-login-redirect-to-index-instead-of-previous-page/page__st__20
Credits to the forum and posters
edit includes/application_top
// navigation history
if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
$broken_navigation = $navigation;
$navigation = new navigationHistory;
$navigation->unserialize($broken_navigation);
} elseif (!is_object($navigation)) {
$navigation = new navigationHistory;
}
} else {
tep_session_register('navigation');
$navigation = new navigationHistory;
}
$navigation->add_current_page();
Please read forum for full info
Attached file is nothing
The idea of this contrib is good. But there is a big issue with it which has no solution except of adding all possible files that must not be show to user after he takes some acton.
Examples:
1. Not logged user go to the login page from eg. index page. He forgot password and restore it, clicking the "I forgot password" link. After that he redirects to login page again. If the user now enters the new login and password, he will be redirected to password forgotten page! but, because he actually login into the shop he receive a message about password changes again, redirected to login page, staying logged in. Very rude!
The solution is to add a password forgotten link to the list of excluded links.
2. The not logged user click one of the popup page and after that click to log in page. After successfully login he will be redirected to this poup page without any navigation!
The solution: include all popups to the exclude list.
3. Some AJAX may cause above errors. Eg. On registration page some AJAX script do something and return values. After registration completed the newly registered user will be redirected to the page with AJAC results.
The solution: add all your AJAX scripts to excluded list.
And so on. I don't recommend to use this contrib or you must very carefully test all possible situation. Remember! All the programmer think that user nevr do, the real user do any way.
Sorry my bad english. I think, my suggesions are clear.
NO FILES ATTACHED
Previous files will break Password Forgotten feature.
Now repaired
// if the customer is not logged on, set the page to return to upon login
if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) != FILENAME_LOGOFF) && (basename($PHP_SELF) != FILENAME_CREATE_ACCOUNT) && (basename($PHP_SELF) != FILENAME_CREATE_ACCOUNT_SUCCESS) && (basename($PHP_SELF) != FILENAME_PASSWORD_FORGOTTEN)) {
$navigation->set_snapshot();
}
FULL PACKAGE
Updated full pack, with install fix by faalyjet
Small Fix:
###Find:
if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) != FILENAME_LOGOFF) && (!strstr($PHP_SELF,'create')) && (!strstr($PHP_SELF,'popup'))) {
###Replace with:
if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) != FILENAME_LOGOFF) && (basename($PHP_SELF) != FILENAME_CREATE_ACCOUNT) && (basename($PHP_SELF) != FILENAME_CREATE_ACCOUNT_SUCCESS) ) {
That's all. No file.
faaliyet
There was a missed line. In logoff.php (not "logout"), when clicking in Continue button, the Page still redirected to index.php, this was due to the link of the botton was still index.php, for fix it just...
-Search:
<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
-And replace by:
<td align="right"><?php echo '<a href="' . $link . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
I've updated the files and the install.txt file for 2 faults that where in them.
In the file application.php there was a bracket missing at the end.
In the file logoff.php you cannot just place the code anywhere but it must at least be after the line : require('includes/application_top.php');
Nice package for the rest though and all the credit goes to Joma Webdesign.
Good work Guys.
This allows User's to log in and return to the page they were asked to login for, not being sent back to index.php
Open application top paste at bottom before ?>
// if the customer is not logged on, set the page to return to upon login
if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) != FILENAME_LOGOFF) && (!strstr($PHP_SELF,'create')) && (!strstr($PHP_SELF,'popup')) {
$navigation->set_snapshot();
}
**************************************
Open Logout.php
Place anywhere
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();
$link = $origin_href;
} else {
$link = tep_href_link(FILENAME_DEFAULT);
}
******************
Thats all
Note: Contributions are used at own risk.