ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - Login - Stay on Page
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Login - Stay on Page

 Post Reply Post Reply
Author
Message
joshs View Drop Down
Newbie
Newbie


Joined: 07-April-2009
Location: Utah
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshs Quote  Post ReplyReply Direct Link To This Post Topic: Login - Stay on Page
    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
Back to Top
macleather View Drop Down
Newbie
Newbie


Joined: 23-June-2008
Location: Los Angeles
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote macleather Quote  Post ReplyReply Direct Link To This Post Posted: 06-June-2011 at 7:08pm
Hi Josh,

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

Alan
Back to Top
joshs View Drop Down
Newbie
Newbie


Joined: 07-April-2009
Location: Utah
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshs Quote  Post ReplyReply Direct Link To This Post Posted: 06-June-2011 at 11:45pm
the link doesn't work.
Josh Shirley
josh@windsurfutah.com
Back to Top
macleather View Drop Down
Newbie
Newbie


Joined: 23-June-2008
Location: Los Angeles
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote macleather Quote  Post ReplyReply Direct Link To This Post Posted: 07-June-2011 at 1:13am
Back to Top
joshs View Drop Down
Newbie
Newbie


Joined: 07-April-2009
Location: Utah
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshs Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
macleather View Drop Down
Newbie
Newbie


Joined: 23-June-2008
Location: Los Angeles
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote macleather Quote  Post ReplyReply Direct Link To This Post Posted: 07-June-2011 at 6:33pm
Ooops, I did misunderstand. I'm afraid I can't help on that one.
Back to Top
Greg Dinger View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers
Avatar

Joined: 23-September-2006
Location: United States
Status: Offline
Points: 238
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greg Dinger Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
joshs View Drop Down
Newbie
Newbie


Joined: 07-April-2009
Location: Utah
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshs Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
joshs View Drop Down
Newbie
Newbie


Joined: 07-April-2009
Location: Utah
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshs Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.