Jump to content

How to only display the subdomain selection on order form? Not the oth domain registration options.


webmaster305

Recommended Posts

I'd like to offer free hosting and I need the subdomain selection box to be displayed on the order form in order for whmcs to automatically create the account. However, I do not want to display the regular domain registration options 'register new, transfer and select nameserver'. I have tried to disable the 'require a domain selection' option but then whmcs gives an error when trying to automatically set up the account.

 

Also, since I'm going to offer free hosting I'd like the payment section to not be displayed in the order form.

 

Please help, thanks.

Link to comment
Share on other sites

if you don't want to offer domains at all (even without hosting), you can disable the 3 options in setup -> general settings -> domains (first 3 checkboxes)... that'll remove the option from products too.

 

if you want to offer domain registration etc, but just not with this product, then you'd likely either need to edit the appropriate template or use an action hook.

Link to comment
Share on other sites

brian!, I know that I can offer hosting with the standard domain registration options in the order form without the subdomain option appearing.

 

What template or file do I need to edit to offer free hosting without those domain registration options but while only showing the subdomain selection option? thanks

Link to comment
Share on other sites

  • WHMCS Support Manager

Hi,

There is not currently an option to restrict the domain options on a per-product basis only. The settings brian described are system-wide.

 

However we welcome feature requests online at http://requests.whmcs.com

Feel free to add your vote to this existing idea: https://requests.whmcs.com/topic/option-to-only-allow-for-subdomain

Link to comment
Share on other sites

brian, I removed the domain ordering options like you suggested but the problem is that when my customers eventually want to upgrade their free hosting to premium hosting with domain name how will they be able to register a domain at that point?

as John says, those 3 settings are system wide and so will disable each for products and domains too.

 

to custom tweak it for specific products or groups, then you'd need a template edit (configureproductdomain.tpl) or an action hook...

 

for editing the template, I previously posted the method here.

 

although, it might be easier if you were to use an action hook - as then you won't need to constantly update the template after an update..

 

so let's assume you have those three checkboxes ticked and the 3 domain registration options are available for domains and all products - now, if you have a product (with an ID of 1) that has a subdomain option, but you don't want to offer registration/transfer/own domain options, you can do this in a hook...

 

<?php

# Configure Domain Settings For Products
# Written by brian!

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

   global $productinfo;

   if ($productinfo['pid'] == "1") {
       return array(
       "registerdomainenabled" => "",
       "transferdomainenabled" => "",
       "owndomainenabled" => "");        
   }
});

if you had a product group (group id = 2) to which you wanted to give it's products the same domain settings, you could do...

 

<?php

# Configure Domain Settings For Products
# Written by brian!

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

   global $productinfo;

   if ($productinfo['gid'] == "2") {
       return array(
       "registerdomainenabled" => "",
       "transferdomainenabled" => "",
       "owndomainenabled" => "");        
   }
}); 

alternatively, you could do the opposite and so if all 3 domain options were DISABLED (unticked) in general settings, then the user couldn't use register/transfer/own domain options by default... if you then wanted to add these options to a product, you could do this...

 

<?php

# Configure Domain Settings For Products
# Written by brian!

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

   global $productinfo;

   if ($productinfo['pid'] == "2") {
       return array(
       "registerdomainenabled" => "on",
       "transferdomainenabled" => "on",
       "owndomainenabled" => "on",
       "domainoption" => "register"
       );        
   }
});

i'm trying to keep these examples very simple (and resisting the urge to show how to do some clever things with this!) but obviously you can mix & match the conditions to your own needs... e.g some product groups might just need register/owned options, some products might just be register/transfer while some others might be transfer-only - it's just a case of adding the correct IF statements to the one hook to specify which products/groups needs which domain options. :idea:

 

e.g if in your setup, you have the 3 domain options ENABLED, then you might want to get the hook to hide the 3 options for a free hosting product, but show them for the paid product... under those circumstances, you would just use the hook to modify the free hosting product but not add the paid product to the hook (as it's not needed)... if you're doing the opposite and keeping the 3 domain options disabled for all products & domains, then you need to add the paid product to the hook and not the free one.

 

if you have a specific problem trying to do this, then don't hesitate to ask... but once you get started with this, it should slowly begin to make sense. :)

 

However we welcome feature requests online at http://requests.whmcs.com

Feel free to add your vote to this existing idea: https://requests.whmcs.com/topic/option-to-only-allow-for-subdomain

good luck getting a feature request implemented with a handful of votes... :roll:

Link to comment
Share on other sites

  • 2 years later...

Hello, brian! Thanks so much for the code, but too bad, i'm so dumb so I don't know how to use it right. Maybe you could help me? I'm trying to do it almost a day now :) 

Here is what I've done:

  • I have enabled "Allow Smarty PHP Tags" 
  • I have unchecked all the ticks in "Domain Registration Options"
  • I have used your code in the file configureproductdomain.tpl

here is how it looks in the file right now:

{php}


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

    global $productinfo;

   if ($productinfo['pid'] == "1") {
       return array(
       "registerdomainenabled" => "on",
       "transferdomainenabled" => "on",
       "owndomainenabled" => "on",
       "domainoption" => "register"
       );   
   }

});

{/php}

I guess, did everything right, but it just doesn't work..

When I open my link: http://hostingspace24.com/system/cart.php?a=add&pid=1 

nothing changes and I can't get it customize... What I need is:  for Free Hosting only to show subdomain, for Premium Hosting - use own domain

Thank you !!!! 

 

Link to comment
Share on other sites

  • 9 months later...
  • 2 years later...

Hello @brian!

I've created a hook file:

<?php

# Configure Domain Settings For Products
# Written by brian!

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

   global $productinfo;

   if ($productinfo['pid'] == "257") {
       return array(
       "registerdomainenabled" => "",
       "transferdomainenabled" => "",
       "owndomainenabled" => "");        
   }
});

 

But is not running for me:
https://cli.ginernet.com/cart.php?a=add&pid=257

Can you help me please?

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