Print Page | Close Window

Login - Stay on Page

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=4527
Printed Date: 13-July-2025 at 6:39am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Login - Stay on Page
Posted By: joshs
Subject: Login - Stay on Page
Date Posted: 06-June-2011 at 11:29am
Using 4.1a.

I am trying to set up a login with redirect back to the current page.
I don't want the customer to be directed away from what they are looking at.

How can I login customers in and keep them on the current page?

I noticed in the checkout.asp page code this exists:
But it doesn't always work.

dim pcRequestRedirect
pcRequestRedirect=getUserInput(request("redirectUrl"),250)

if Session("SFStrRedirectUrl")<>"" AND pcRequestRedirect="" then
else
     Session("SFStrRedirectUrl")=pcRequestRedirect
end if


Thanks for any ideas.

Josh
801 906-8396

-------------
Josh Shirley
josh@windsurfutah.com



Replies:
Posted By: macleather
Date Posted: 06-June-2011 at 7:08pm
Hi Josh,

Here's the link to the WIKI. Scroll down to "stay on page.."
%20 - http://wiki.earlyimpact.com/productcart/settings-misc?s[ - =stay&s[ - =page

Alan

-------------
Alan
http://www.mcpcustomleather.com - MacPherson Custom Leather


Posted By: joshs
Date Posted: 06-June-2011 at 11:45pm
the link doesn't work.

-------------
Josh Shirley
josh@windsurfutah.com


Posted By: macleather
Date Posted: 07-June-2011 at 1:13am
Josh,

Sorry, try this.

http://wiki.earlyimpact.com/productcart/settings-misc?s%5b%3E=stay&s%5b%3E=page - http://wiki.earlyimpact.com/productcart/settings-misc?s[%22%3E=stay&s[%22%3E=page

-------------
Alan
http://www.mcpcustomleather.com - MacPherson Custom Leather


Posted By: joshs
Date Posted: 07-June-2011 at 6:26pm
Humm, maybe I am missing something or I haven't asked the question clearly.

I want my login form to allow a customer to login and stay on the current page, instead of being redirected to custpref.asp.





-------------
Josh Shirley
josh@windsurfutah.com


Posted By: macleather
Date Posted: 07-June-2011 at 6:33pm
Ooops, I did misunderstand. I'm afraid I can't help on that one.

-------------
Alan
http://www.mcpcustomleather.com - MacPherson Custom Leather


Posted By: Greg Dinger
Date Posted: 07-June-2011 at 6:41pm
Josh - have a look at atc_instprd.asp - the module that redirects from instprd.asp back to some page for the "stay on page" feature.  I authored the bulk of that code and had to achieve a similar goal.   What it does is to make decisions based on the originating URL as to what sort of page the request came from.  Then it eventually forms a URL to return to.
 
Your case will differ.  You still need to determine where you came from, and thereby know where to return to.  But it's a little trickier since the current login already performs the custpref.asp redirect that you now need to overcome.  If you have some time and need this done for you, we could take it on.  But I have a suspicion that this is a large enough task that it's going to be tough to tackle here in the forum with a hint one way or another.


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: joshs
Date Posted: 07-June-2011 at 7:34pm
Looks like Session("SFStrRedirectUrl")= "whatever page redirecting to"
seems to do it.

Although AJAX would be smoother.

Can I establish sessions with AJAX?

I will post up the form after I finalize it.

-------------
Josh Shirley
josh@windsurfutah.com


Posted By: joshs
Date Posted: 21-June-2011 at 11:55pm
Finally had a chance to re-engage this. 
This seems to work.

Add this to the login link.
onclick="return false;" id="LG"
so it would look like:
<a href="Checkout.asp?cmode=1" onclick="return false;" id="LG">Log In</a>

This needs to be added to the inc_footer.asp file before the '// Restore Cart line.

<%
if session("idCustomer")="0" or session("idCustomer")="" then
%>
<div id="LGMsgDialog" title="Login" style="display:none">
<div id="LGMsg" style="width: 80%;">
<div class="ui-main">
          <form name="login" method="post" action="checkout.asp?cmode=1">
             <table width="100%">
             <tbody style="text-align:left;">
             <tr>
             <td>Email</td><td><input type="text" size="35" name="LoginEmail"></td>
             </tr>
             <tr>
             <td>Password </td><td><input type="password" name="LoginPassword"></td>
             </tr>
             </table>
             <input name="PassWordExists" type="hidden" value="YES" >             
             <input type="hidden" name="SubmitCO.y" value="1">             
             <input type="hidden" name="redirectUrl" value="" id="location"/>
             <script type="text/javascript">
             document.getElementById('location').value=(location.href);
             </script>             
          </form>        
        </div>
</div>
</div> 
<script type="text/javascript">           

$(document).ready(function()
{
$("#LGMsgDialog").dialog({
 bgiframe: true,
 autoOpen: false,
 resizable: false,
 width: 400,
 modal: true,
 buttons: {
' Close ': function() {$(this).dialog('close');},
' Open New Account ': function() {location='<%=tempFooterURL%>checkout.asp?cmode=1'; $(this).dialog('close'); },
' Submit ': function() {document.login.submit(); $(this).dialog('close');}
}
});

$('#LG').click(function(){
  $("#LGMsgDialog").dialog('open');
  return ;
}); 
});     
</script>
<% end if %>

The "redirecturl" needs to be generated correctly and VB requests pull in long url with the 404 SEO errors.  Javascript generates the 'location.href' after the page is rendered so the redirecturl is correct.


-------------
Josh Shirley
josh@windsurfutah.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net