Jump to content

Domain Registration as a separate product


Netguy

Recommended Posts

Hello,

Is it possible to have the domain registration as a different product that I display only once the user purchases a product X and logs in - and for this particular product I want to have a different payment method than the one that I have as a default. Is this possible?

Special shoutout to @brian! and @Kian for always helping us out!

Link to comment
Share on other sites

3 minutes ago, Netguy said:

Is it possible to have the domain registration as a different product that I display only once the user purchases a product X and logs in - and for this particular product I want to have a different payment method than the one that I have as a default. Is this possible?

in other words, before you can register a domain name, the client needs to have purchased product X - only then will they see the domain register page?

that's going to be a couple of hooks - one to remove the navbar/sidebar links to the domain registration page, and a second one to ensure that they can't go direct to the page, unless your conditions are met.

Link to comment
Share on other sites

5 hours ago, Netguy said:

Can you guide me on how to go create a hook to not allow directly to go to that page

it would probably take me longer to explain how to do it than to actually do it for you - and i've posted a similar hook previously anyway. 🙂

<?php

# Redirect Users From Domain Registration Hook
# # Written by brian!

use WHMCS\Database\Capsule;

function redirect_users_from_domain_registration_hook($vars)
{
	$client = Menu::context('client');
	$clientid = $client->id;
	$validproducts = array(1,2);
	$activecount = Capsule::table('tblhosting')->where('userid',$clientid)->whereIn('packageid',$validproducts)->where('domainstatus','Active')->count();
	if ($vars['templatefile'] == 'domainregister' && $activecount == 0) {
		header("Location: cart.php");
		exit;
	}
}
add_hook("ClientAreaPageCart", 1, "redirect_users_from_domain_registration_hook");

if the user tries to go to the domain reg page, but is either not logged in with applicable product(s), or not logged in at all, they'll be redirected to another page - currently back to the main cart page.

the only line you should need to change is the list of product ID(s) in the $validproducts array.

btw - this hook will have no impact on products that require a domain - this only applies to registering domains directly.

5 hours ago, Netguy said:

how I can have a different payment method?

by default, domain registrations can use any gateway - so the method i've previously described would be to remove the gateway(s) that you don't want to use for domain registrations.... again, that's another clientareapagecart hook, and optionally a clientareapageinvoice hook if you need to prevent them choosing another gateway at the invoice stage... almost certainly, I will have already posted these here previously.

what you will have to think about is what happens if the user orders a domain registration and product Y - do you force them to use your domain reg only gateway or can they use any payment gateway option ?

 

Link to comment
Share on other sites

Thanks, @brian!.

Well, I don't want domain registrations to be allowed with product Y. So using the hook you wrote above, it won't be available for them. 

All in all what I'm looking to do is, have a link in sidebar called "Upgrade to a domain" only for my Pro users. Then once they click on that - they have the domain registration process and the payment only goes through one gateway - PayPal. So to set only one domain as a payment gateway - I have to write a hook that removes other payment methods on the domain registration page?

Link to comment
Share on other sites

12 hours ago, Netguy said:

Well, I don't want domain registrations to be allowed with product Y. So using the hook you wrote above, it won't be available for them. 

let's say you have 3 products - Alpha, Beta and Gamma... and then let's also assume that your clients need to have an active "Alpha" service before they can access the domain registration page (as per the above hook).

so a user with an active Alpha service logs in... they can now register a domain (and hence need to pay using PayPal).... but what happens if they've added Beta or Gamma to the cart too? can they still only pay with PayPal or can they use the gateways allowed with Beta & Gamma ??

12 hours ago, Netguy said:

All in all what I'm looking to do is, have a link in sidebar called "Upgrade to a domain" only for my Pro users. Then once they click on that - they have the domain registration process and the payment only goes through one gateway - PayPal.

but once in the cart, they could add other products / services if they want to - or at least I assume but only you know which products you're selling! if you're telling me that there are no other products they can access in the cart, other than domain reg, then fine that simplifies it.

13 hours ago, Netguy said:

I have to write a hook that removes other payment methods on the domain registration page?

effectively, you're removing gateways from checkout - but you're going to do need to do that based on what's in the cart.... so if it's only a domain, then that's simple enough and you remove every gateway apart from PayPal... if there is a domain and a product/service in the cart, then that's why i'm asking what you want to do in those circumstances - stick with PayPal only, or allow other gateways?

all options are doable - but the answer to the above will change what the conditions you have to check for will be. 🙂

Link to comment
Share on other sites

I somehow managed to complicate this a lot more and never thought of telling you the real issue.  So the issue I'm currently facing is - I've GoCardless as the payment gateway and Hexonet as the domain registrar. I've two plans - Basic and Pro. In the Basic plan, a user is not allowed to register a domain. In Pro, it is allowed. Now what is happening is when a user orders Pro with domain registration - Hexonet module doesn't process it and I've to log in - change it from None to Hexonet and click on Accept Order. 

Now to avoid this hassle, what I thought was to have the domain registration only once the user creates an account so he/she at least has a free subdomain (which I'm offering with both plans) to begin work with. Initially, I thought this issue was with a payment gateway but it looks like it is domain registration. When I thought that a payment gateway was causing it - I kinda assumed having a different gateway for domain registration would help and since I'm not offering domain registration for Basic - I would enable that page only for Pro. 

Thank you for helping out so much despite me not being able to explain it clearly. Let me know if I need to elaborate or clear up something more. 

Link to comment
Share on other sites

 

23 hours ago, Netguy said:

I somehow managed to complicate this a lot more and never thought of telling you the real issue.  So the issue I'm currently facing is - I've GoCardless as the payment gateway and Hexonet as the domain registrar. I've two plans - Basic and Pro. In the Basic plan, a user is not allowed to register a domain. In Pro, it is allowed. Now what is happening is when a user orders Pro with domain registration - Hexonet module doesn't process it and I've to log in - change it from None to Hexonet and click on Accept Order. 

Now to avoid this hassle, what I thought was to have the domain registration only once the user creates an account so he/she at least has a free subdomain (which I'm offering with both plans) to begin work with. Initially, I thought this issue was with a payment gateway but it looks like it is domain registration. When I thought that a payment gateway was causing it - I kinda assumed having a different gateway for domain registration would help and since I'm not offering domain registration for Basic - I would enable that page only for Pro. 

Thank you for helping out so much despite me not being able to explain it clearly. Let me know if I need to elaborate or clear up something more. 

@brian! Could you help out with this here or should I create a new thread for it?

Link to comment
Share on other sites

18 hours ago, Netguy said:

Could you help out with this here? 

sure - I bookmarked the thread last week when you replied, but have been too busy with other commercial projects to look at this closely - though I think your clarifications have simplified the required coding.

i'm not working today, so i'll take a look at this on Monday.

Link to comment
Share on other sites

@indy0077, just an observation here from the screenshot.

I'm pretty sure now a dedicated IP address is not required anymore for SSL purposes. It's named based, top-level TLD. (Correct me if I'm wrong here though).

BUT saying that, there are other reasons you probably have that listed, ie, Selling VPS's, customers just wanting to stay away from a 'Shared IP', etc.

 

Link to comment
Share on other sites

1 hour ago, astewart said:

@indy0077, just an observation here from the screenshot.

I'm pretty sure now a dedicated IP address is not required anymore for SSL purposes. It's named based, top-level TLD. (Correct me if I'm wrong here though).

BUT saying that, there are other reasons you probably have that listed, ie, Selling VPS's, customers just wanting to stay away from a 'Shared IP', etc.

 

>>> I'm pretty sure now a dedicated IP address is not required anymore for SSL purposes. It's named based, top-level TLD. (Correct me if I'm wrong here though).

That's rigt, it's an "outdated" notice of the additional IPs for shared hosting plans.

Link to comment
Share on other sites

  • 4 months later...

@ brian!

Hi Brian,

I have a question: Would it be possible to move the first step "Choose a Domain" if ordering a hosting package somewhere between the package and configurable options code (id="productConfigurableOptions") and addons on the second step order page?

step-1-choose-domain.png

step-2-choose-domain.png

 

I find this behavior very annoying and hate it. For me would be more "naturally" to see the ordered package first and choosing of the domain name as second.

Many thanks in advance!

Link to comment
Share on other sites

21 hours ago, isixhosting said:

Would it be possible to move the first step "Choose a Domain" if ordering a hosting package somewhere between the package and configurable options code (id="productConfigurableOptions") and addons on the second step order page?

possible? probably, but for something like this it would preferably need it's developer to do it... though as v7.10 is the last major release before v8, I would have thought that everyone will be waiting to see what v8 brings before making any commitments.

I seem to recall Lagom saying last year that they were working on a one-step cart orderform template with MG - but I don't know if that was ever released.... i would be astonished if v8 doesn't include new orderform templates.

Edited by brian!
Link to comment
Share on other sites

12 minutes ago, brian! said:

possible? probably, but for something like this it would preferably need it's developer to do it... though as v7.10 is the last major release before v8, I would have thought that everyone will be waiting to see what v8 brings before making any commitments.

I seem to recall Lagom saying last year that they were working on a one-step cart orderform template with MG - but I don't know if that was ever released.... i would be astonished in v8 doesn't include new orderform templates.

Ok, I will wait for the V8.

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