I hate the fact that x-cart takes you back to the home page if you log into the site without anything in your cart. Here's the mod that will take you back to the page you just came from when you log in.
+++++++++++++++++++++++++++++++++++++++++++++
This modification will take you back to the page you came from unless you have something in your cart. In the latter case, it will take you to your shopping cart.
+++++++++++++++++++++++++++++++++++++++++++++
Original File: login.php
Code:
if ($login_type=="C") {
if(!func_is_cart_empty($cart))
header("Location: ../$redirect/cart.php");
else
header("Location: ../$redirect/home.php");
exit;
}
Modified File: login.php
Code:
if ($login_type=="C") {
if(!func_is_cart_empty($cart))
header("Location: ../$redirect/cart.php");
else {
$relo_page = strrchr($_SERVER['HTTP_REFERER'], '/');
$relo_page = str_replace('/', '', $relo_page);
header("Location: ../$redirect/$relo_page");
}
exit;
}
+++++++++++++++++++++++++++++++++++++++++++++
This modification will allow you to control which pages redirect you back to shopping cart, which redirect you back to the homepage and which you want redirected back to the page they came from. Simply adjust the order to suit your priorities and add &locator=1 to any page's url that you would like the user to be redirected to once they log in. You can also add as many &locator=#'s to the if statement and move people all around the site

+++++++++++++++++++++++++++++++++++++++++++++
Original File: login.php
Code:
if ($login_type=="C") {
if(!func_is_cart_empty($cart))
header("Location: ../$redirect/cart.php");
else
header("Location: ../$redirect/home.php");
exit;
}
Modified File: login.php
Code:
if ($login_type=="C") {
if (strstr($_SERVER['HTTP_REFERER'], 'locator=1')){
$relo_page = strrchr($_SERVER['HTTP_REFERER'], '/');
$relo_page = str_replace('/', '', $relo_page);
header("Location: ../$redirect/$relo_page");
}
elseif(!func_is_cart_empty($cart))
header("Location: ../$redirect/cart.php");
else
header("Location: ../$redirect/home.php");
exit;
}
+++++++++++++++++++++++++++++++++++++++++++++
And finally...
This modification is the same as the first one, but will also recognize if your user is logging in while in the middle of the checkout process of the shopping cart and will redirect them to the next step in the checkout process rather than taking them back to step one.
+++++++++++++++++++++++++++++++++++++++++++++
Original File: login.php
Code:
if ($login_type=="C") {
if(!func_is_cart_empty($cart))
header("Location: ../$redirect/cart.php");
else
header("Location: ../$redirect/home.php");
exit;
}
Modified File: login.php
Code:
if ($login_type=="C") {
if (strstr($_SERVER['HTTP_REFERER'], 'cart.php?mode=auth')){
header("Location: ../$redirect/cart.php?mode=checkout");
}
elseif(!func_is_cart_empty($cart))
header("Location: ../$redirect/cart.php");
else {
$mover = strrchr($_SERVER['HTTP_REFERER'], '/');
$mover = str_replace('/', '', $mover);
header("Location: ../$redirect/$mover");
}
exit;
}
I have been adding to this message as I have been coding so it's kind or a patchwork of stuff, hope no one gets confused
