Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

After login Stay on Current page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-03-2011, 03:25 AM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default After login Stay on Current page

I have a x cart Pro 4.4.2 based store.I have added login link in one of my static page by adding login.php.But after login I want to stay on that current page.Currently after login it goes to cart page if some product added in cart or in home page.

I want to stay current page after login.How to achieve that in 4.4.x version?

Thanks to all.
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
  #2  
Old 12-03-2011, 07:06 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: After login Stay on Current page

You need to modify the login php script and change the redirect to current page instead. There will be at least 2 places in the file to modify - one for if anythign in cart and one if nothing in cart on successful login
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 12-03-2011, 09:03 PM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default Re: After login Stay on Current page

Hi Steve,

Thank you for your quick reply.But how to achieve that? What exactly to be change can you help me?

Thanks.
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
  #4  
Old 12-04-2011, 06:37 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: After login Stay on Current page

Yes I can help you with this, contact me at the email in my signature
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 12-04-2011, 07:10 AM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default Re: After login Stay on Current page

Hi,
Can you help me here?

Thanks.
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
  #6  
Old 12-06-2011, 04:26 AM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default Re: After login Stay on Current page

Hi,
Anyone in the forum to solve the issue !!! I want help.

Thanks to all.
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
  #7  
Old 12-14-2011, 01:43 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: After login Stay on Current page

Here's an old code sample for 4.0/4.1 that might get you started:


In include/login.php, replace:
PHP Code:
if (!func_is_cart_empty($cart)) { 
with:
PHP Code:
if ($login_type == "C") {
    
func_header_location($redirect_to."/pages.php?pageid=29");
} elseif (!
func_is_cart_empty($cart)) { 
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following 2 users thank cherie for this useful post:
carpeperdiem (11-12-2012), chamberinternet (01-30-2012)
  #8  
Old 11-12-2012, 10:12 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: After login Stay on Current page

Quote:
Originally Posted by cherie
Here's an old code sample for 4.0/4.1 that might get you started:


In include/login.php, replace:
PHP Code:
if (!func_is_cart_empty($cart)) { 
with:
PHP Code:
if ($login_type == "C") {
    
func_header_location($redirect_to."/pages.php?pageid=29");
} elseif (!
func_is_cart_empty($cart)) { 

Works great in 4.5.4 -- except it fails on checkout page (OPC w/ajax)

What I did:
include/login.php

find:
PHP Code:
if (!func_is_cart_empty($cart)) { 

replace:
PHP Code:
// EDIT Redirect to account page on login
//if (!func_is_cart_empty($cart)) {
if ($login_type == "C") { 
        
func_header_location($redirect_to.'register.php?mode=update'); 
    } elseif (!
func_is_cart_empty($cart)) {
// END Redirect to account page on login 

On any page except OPCajax, a link to /login.php goes to /login.php and provides a form. After the customer logs in, customer is redirected to /register.php?mode=update -- exactly what I want.

However, if the login process starts on the OPCajax checkout page, the link to login makes a popup -- and then the login happens, but the popup hangs. If the customer closes the popup and reloads the page, the login was successful -

Anyone have a suggestion as to how to get this code working with the OPCajax login popup?

Thx
J
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #9  
Old 12-02-2012, 07:52 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: After login Stay on Current page

Update:

I bailed on OPC and am back using CheckoutOne so I can use this code -- except in CheckoutOne, it redirects the customer to the account page regardless of cart or checkout status.

So I need to edit the code to only redirect to account page IF not in checkout or if cart is empty.

Any ideas? Thanks.
J
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:20 AM.

   

 
X-Cart forums © 2001-2020