Jump to content

Login before continue ordering


Infused-Hosting

Recommended Posts

Hi,

I am looking to achieve the following when ordering on our WHMCS.

 

All of our items are ordered through our main website - Each item links directly into the cart / item configuration on WHMCS. We do not allow browsing or selecting products within WHMCS itself.
I googled and found a hook that allows me to redirect anyone who accesses the cart to the login/registration page. This is great but once registered or logged in, they are redirected to the client area and not the cart so they can continue with their order.

Id prefer if possible that the client is then redirected back to complete their order rather than having to start over again going back to the main website to click on a new product to start again.

Thanks
Alec

Link to comment
Share on other sites

34 minutes ago, Infused-Hosting said:

I googled and found a hook that allows me to redirect anyone who accesses the cart to the login/registration page.

what's the hook code within it ? just wondering if the hook is calling clientarea.php directly (it's often used as a short cut method for logging in)...

38 minutes ago, Infused-Hosting said:

This is great but once registered or logged in, they are redirected to the client area and not the cart so they can continue with their order.

you can add a hidden field to the login form template (login.tpl) and use that to redirect all users to a given page, e.g cart.php, after successful login.

<input type="hidden" name="goto" value="cart.php">

if you needed to just pass some users to this redirect, then i'd probably get the original hook to goto login.php and pass a parameter that the template then checks for, and if set, includes the hidden redirection field.

Link to comment
Share on other sites

6 minutes ago, brian! said:

what's the hook code within it ? just wondering if the hook is calling clientarea.php directly (it's often used as a short cut method for logging in)...

you can add a hidden field to the login form template (login.tpl) and use that to redirect all users to a given page, e.g cart.php, after successful login.


<input type="hidden" name="goto" value="cart.php">

if you needed to just pass some users to this redirect, then i'd probably get the original hook to goto login.php and pass a parameter that the template then checks for, and if set, includes the hidden redirection field.

Hi Brian,

 

Thanks for the info. The code for the hook I'm using it the following:

 

<?php

add_hook("ClientAreaPageCart",1,function($vars){

   $client = Menu::context("client");
   $clientid = (int) $client->id;

   if ($clientid===0){
   header("Location: login.php");
       exit;
   }    
});



?>

 

All I want really is so when people click through our website using a direct link to the product ordering, it asks them to login or register first then redirect them back to continue with the product ordering.

Thanks

 

Alec

Link to comment
Share on other sites

44 minutes ago, Infused-Hosting said:

All I want really is so when people click through our website using a direct link to the product ordering, it asks them to login or register first then redirect them back to continue with the product ordering.

but they would have to login / register anyway at some point (e.g checkout), so i'm not sure I see the point in interrupting the cart flow for this.... so unless there is some additional account verification occurring, then this isn't going to stop anyone ordering - just slightly delay them.

the problem is, if they're not already registered, there is no real point in passing them to login, as they will need to register... and so you'd end up losing the redirect value.... it's fixable I think, but i'm loathed to overcomplicate a solution unless necessary.

Link to comment
Share on other sites

16 minutes ago, brian! said:

but they would have to login / register anyway at some point (e.g checkout), so i'm not sure I see the point in interrupting the cart flow for this.... so unless there is some additional account verification occurring, then this isn't going to stop anyone ordering - just slightly delay them.

the problem is, if they're not already registered, there is no real point in passing them to login, as they will need to register... and so you'd end up losing the redirect value.... it's fixable I think, but i'm loathed to overcomplicate a solution unless necessary.

Hi Brian

 

The main reason is so any potential customer has to sign up before being able to proceed with the order so if they decide not to finish the order for some reason, we still have their details so we can send them an automatic email to try and get them back. 

We seem to see a lot of potential customers going through the checkout system but then not finalising a purchase for some unknown reason hence the idea above. 

If its not feasible or doable then we'll leave it as normal but I'm seeing more and more companies asking for login/sign up before the cart system

 

Thanks 

Link to comment
Share on other sites

Hi Alec,

11 minutes ago, Infused-Hosting said:

The main reason is so any potential customer has to sign up before being able to proceed with the order so if they decide not to finish the order for some reason, we still have their details so we can send them an automatic email to try and get them back. 

I can see the potential benefit of registering first, it's just the convoluted process of send them to get cart -> redirect to login or register -> send them back to the product they were looking at.... it's this last bit that's the pain in the proverbial - it would have been slightly easier with earlier WHMCS versions, but some of those solutions might not be an option with v8.

13 minutes ago, Infused-Hosting said:

We seem to see a lot of potential customers going through the checkout system but then not finalising a purchase for some unknown reason hence the idea above. 

heard similar stories previously....

20 minutes ago, Infused-Hosting said:

If its not feasible or doable then we'll leave it as normal but I'm seeing more and more companies asking for login/sign up before the cart system

I don't think there's a quick simple way to do it - i'm pretty sure register.php always redirects to clientarea upon successful completion and unlike login.php, there's no redirection parameter that can be used to send them elsewhere...

if you could just send them to register.php first, e.g tell users they need to register and login to order from you, then the above hook would not apply and the direct links to your products would work as normal.

I can see what you want to do, but I can't help thinking that the users who are patient enough to register first etc, are unlikely to be the same ones who quit during the ordering process.

Link to comment
Share on other sites

4 hours ago, brian! said:

I don't think there's a quick simple way to do it - i'm pretty sure register.php always redirects to clientarea upon successful completion and unlike login.php, there's no redirection parameter that can be used to send them elsewhere...

Probarbly not. Have been looking into this ourselves and doesnt appear to be straight forward HAVING said that I have seen at least 2 whmcs users (dont know if I should/can mention there names) that actually have this setup and working on there live sites i.e. register and login before cart process BUT the big difference is that the kind of products and services they sell are more suited to someone who would definitly want to buy that service. For bog standard hosting customers I think its going to be the same drop off rate either way with register/login vs standard cart flow...

Experimenting with a flow like woocommerce whereby the details are asked for at an earlier stage (thus collecting details) and then rest of the cart flow (still testing etc) that way IF its a drop off the details are present to hopefully (send abondon ed cart email 🤔 ideally) testing, pondering and more testing OR should I say battering our heads against a wall ATM

Link to comment
Share on other sites

14 hours ago, Manchester Web Hosting said:

I have seen at least 2 whmcs users (don't know if I should/can mention there names) that actually have this setup and working on there live sites i.e. register and login before cart process BUT the big difference is that the kind of products and services they sell are more suited to someone who would definitely want to buy that service. For bog standard hosting customers I think its going to be the same drop off rate either way with register/login vs standard cart flow...

I don't think it matters if you mention their names.... if users could find them via Google, then there's no harm in listing them.

I don't have a problem with someone wanting their users to login first before ordering... i've posted numerous hooks over the years to either do that generically, or only for specific products... even the above hook that infused lists might have been written be me three years ago...

but there are complicating factors with the infused scenario - in that, the cart seemingly won't show products direct (even when logged in), so the product links would be on a non-WHMCS site... the user would always need to register / login before ordering.... which is fine, except infused seem to want the user to choose a product first, then login/register, then get redirected back to the product to carry on the ordering process as normal.. as I said, it's doable as logins could be handled by a template redirection and registrations might require a ClientAreaRegister hookto be used to handle the redirection back to the specific product.

I would suspect that those two sites you know of, will ask users to register/login first and THEN choose the product and continue with the cart flow...

Link to comment
Share on other sites

  • 2 weeks later...
On 2/17/2021 at 3:34 PM, brian! said:

I don't think it matters if you mention their names.... if users could find them via Google, then there's no harm in listing them.

Sorry, been busy doing jobs and not had the chance to post a reply.

I guess there isnt... Nifty gocardless (in2 computing) site has it working eaxctly like we AND many othr users would want. You choose your product service, go through process and beofre checkout it prompts you to verify your email simple but very effective. Have asked how that works and IF they would be kind enough to share as that 1 thing alone would be super useful (IMHO for us anyways)...

there is another site but forgot where i saved the link will have to dig it out BUT the nifty site is exactly the way I think it should work. IF you @brian! know how thats done OR could shed some light on it that would be great... OR maybe its more for something @Kian as his hooks are quite frankly the dogs b****s

Link to comment
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.

  • 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