Jump to content
Sign in to follow this  
startover909

Make the "Already Registered?" button actually link to login page then re-direct back to checkout

Recommended Posts

Anyone else finds the "Already Registered?" button behavior on the checkout page flawed?

Clicking it triggers JS that simply shows the login username/password boxes without actually letting the user login. 

So the login is performed at the same time as order submission. The idea is that less clicking and not leaving the checkout page is a good thing. Except that:

1. Without actually logging in, the user has to enter the credit card manually instead of using the one on file. This defeats one of the most important benefits of being "registered".

2. If the user enters a credit that is different from the one he has on file, his card on file gets updated without even his knowledge, as no where on the order page suggests that.

3. If the user made a typo on the password, he does not seem to even get a  password incorrect error message, possibly causing confusion

Shouldn't the better approach be what every other online store does: clicking "Already Registered" button actually leads user to login page, then redirects back to the checkout page upon successful login?

Anyone has any idea how to achieve this (the button it self can be edited ini the template I assume, but what about the redirect part?)

Thanks.

Edited by startover909

Share this post


Link to post
Share on other sites

I achieved this myself by creating a basic custom WHMCS page, loginredirectcheckout.php, that has "require login" enabled.

<?php

use WHMCS\ClientArea;
 
define("CLIENTAREA",true);
 
require __DIR__ . '/init.php';
 
$ca = new ClientArea();
  
$ca->initPage();
$ca->requireLogin();
 
$ca->setTemplate('loginredirectcheckout');
 
$ca->output();
 
 ?>


Then on the corresponding  loginredirectcheckout.tpl  file, I simply added one line of  javascript code to  redirect to the checkout page.

<script>
    window.location = 'https://yourwhmcs/cart.php?a=checkout';
</script>

Then I edited the checkout.tpl template, replaced the existing "already registered"  and "register" buttons with a  link to the loginredirect.php file (apply btn and btn-info classes to the anchor to make it look just like the original button):

<a href="/yourwhmcs/loginredirectcheckout.php" class="btn btn-info{if $loggedin} hidden{/if}">{$LANG.orderForm.alreadyRegistered}</a>

Upon clicking, the user will be required to login, then once logged in, redirected right back to the checkout page.

Now credit card info pre-filled. No more confusions etc.

Hopefully this will help others who want their order form to behave like this.

 

Edited by startover909

Share this post


Link to post
Share on other sites

While you're at checkout.tpl (of course, you should copy the original order form template to create your own template), I also recommend that you remove the

 {if $loggedin || $custtype eq "existing"} class="hidden"{/if}

logic from the sign up container

 <div id="containerNewUserSignup"{if $loggedin || $custtype eq "existing"} class="hidden"{/if}>

This way, the users will see their pre-filled info with fields that are set to read-only (already by template) so they get to review their info before submitting the order. This gives them a chance to update their old info which can result in CC declines etc. You may also want to add a little if logic to the "Please enter your personal details and billing information to checkout" heading to make it show something like "If you need to update your billing information, please click here, then return to checkout by clicking "Cart" on the navigatio menu" for logged in users

<p>{if !$loggedin}{$LANG.orderForm.enterPersonalDetails}{else}If you need to update your billing information, please <a href="/yourwhmcs/clientarea.php?action=details">click here</a>, then return to checkout by clicking "Cart" on the navigation menu.{/if}</p> 

Now that is more like a "standard" shopping cart.

Edited by startover909

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By xnetco
      Hello.
      We've recently moved to Stripe and it's working very well for existing recurring card payments. However existing store credit cards don't appear on the checkout page. Do you know if it's possible to add them or migrate them all over to Stripe?
      Tim 
       
       
    • By celse
      If more than one contact exists, when logged in as a contact, the name of the first contact is the one displayed on the header bar (next to logout link).  How can I resolve this issue?
      We're using version 7.10.2
    • By ShaneP
      Hi All 
      I tried to purchase a hosting package on mt whmcs and when i click the checkout button after filling out my details this error comes up. I have also checked with my payment gateway provider and they say it is whmcs problem. The site which i am referring to is https://skyehost.co.za/client/ I have also attached the error message below.
       
      If the community could be so kind to help me with this problem.
      Thanks
      Shane

    • By Ruben Labrado
      I would like someone to help me, my page does not have www. and I try to do the 301 redirection of the url from www to non-www, but no matter how much I added codes that I was finding by google in the htaccess, this redirection is not working. Can anyone help?
    • By Kian
      Every time an administrator uses Login as Client, WHMCS overrides the default language of the selected customer with the one used by the administrator in WHMCS backend. This is bad because you're unknowingly changing the default language for your customer. This also applies for languages that can't be used in clientarea.
      Let's say your clientarea is in italian and you're using WHMCS backend in english. When you perform the Login as Client, WHMCS switches customer's language from italian to english and there's no way back. The customer in question is stucked with a language he cannot change. The following hook prevents that to happen.
      Get the Code »
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated