reneerd Posted July 11, 2018 Share Posted July 11, 2018 Hi all... cutting my teeth on cubecart but like it so far. When anyone logs into their account from the login page (site.com/index.php?_a=login) in on the customer/client side, they are redirected to the "Your Account" (site.com/index.php?_a=account) page. This has proven to be a problem because customers are complaining they wanted to return to the page they were just on or others that if they wanted to see their profile they would have gone to their profile. Long/Short of it: Where do I go to change where the customer/client are redirected after they logged in? Example, I log in and end up back at the landing page. Thanks for any help... I am sure I am missing something simple in the files but am seriously frustrated at this point. Link to comment Share on other sites More sharing options...
bsmither Posted July 11, 2018 Share Posted July 11, 2018 Welcome reneerd! Glad to see you made it to the forums. CubeCart 6.2.1 (CC621) will either send the just logged in visitor to their Account page or to the View Cart page if there are any items in the shopping basket. CC621 prepares everything necessary to bounce the visitor to the immediate page prior to viewing the Login page, but needs a trigger to fire. CubeCart has "hooks" we can use to implement this trigger. Building a hook is easy. Ask any questions you may have , then let us know when you are ready. Link to comment Share on other sites More sharing options...
reneerd Posted July 12, 2018 Author Share Posted July 12, 2018 Thanks smither... Yeah I tend to find the best answers for anything come from the community. Easier to dial in your issues to someone elses. Okay I have seen the article about creating a hook so I should be able to piece together the rudiments of it. Thanks. However, is there a template or post that has some of the coding that would do this? Just to give you a parameter, I am not a ground up coder. If I have something in front of me I can beat it up to make it do what I want with some custom stuff I added as well. I am not looking to get anyone to do this for me I swear :) I am just hoping there is a basic template you might now of. Did a quick search but if there is a template for it its getting lost in the "log in" portion of search term returns Link to comment Share on other sites More sharing options...
bsmither Posted July 12, 2018 Share Posted July 12, 2018 When entering the data into the Code Snippet admin page, use the following: Hook to use: class.cubecart.login PHP Code: <?php if ($GLOBALS['session']->has('back')) {$redir = $GLOBALS['session']->get('back');} Link to comment Share on other sites More sharing options...
reneerd Posted July 12, 2018 Author Share Posted July 12, 2018 Hi and thanks again Smither! Okay once I figured out there was a code snippet section, it was a snap (WAAAAAY overthought it originally). So for the quasi-noobs like me out there I am going to detail what I did with the details you provided. Hopefully it helps someone in the future ================================= To return the customer to the previous page after login do the following: Log into admin side On left sidebar go down to "Manage Hooks" Go to the "Code Snippet" tab Click "Add Snippet" Check enable Give a name you will recognize (EX: Login Return) Determine what order you want this to execute (I put 1) Under trigger dropdown find and left click class.cubecart.login Copy and paste this code into the php code box: <?php if ($GLOBALS['session']->has('back')) {$redir = $GLOBALS['session']->get('back');} Hit save and say THANK YOU SMITHER! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.