PDA

View Full Version : Require domain name to be registered / transferred for only 1 product



AeonCube
12-10-08, 08:52 AM
Require domain name to be registered / transferred for only 1 product
This is perfect if you have a product that you want to force the user to register or transfer a domain name and not be able to use the name servers option when all other products will have this option.

Find the files
Locate configureproductdomain.tpl in the order form template folder you are using:
wwwroot/templates/orderforms/boxes/
wwwroot/templates/orderforms/cart/
wwwroot/templates/orderforms/default/
wwwroot/templates/orderforms/singlepage/

Find these lines


{if $owndomainenabled}
<input type="radio" name="domainoption" value="owndomain" id="selowndomain" onclick="document.getElementById('register').style.display= 'none';document.getElementById('transfer').style.d isplay='none';document.getElementById('owndomain') .style.display='';document.getElementById('subdoma in').style.display='none';document.getElementById( 'incart').style.display='none'" /> <label for="selowndomain">{$LANG.orderdomainoption2}</label><br />
{/if}
After you have found these lines you will need to add an if statement around these.

The if statement is


{if $pid neq '#PRODUCTID#'}
{/if}
Replace #PRODUCTID# with the product ID found in the WHMCS admin or when you go to order a product you will see the ID (pid) in the URL string. (URL Example: http://www.yourdomain.co.uk/whmcs/cart.php?a=add&pid=1)

So the end code will be


{if $pid neq '#PRODUCTID#'}
{if $owndomainenabled}
<input type="radio" name="domainoption" value="owndomain" id="selowndomain" onclick="document.getElementById('register').style.display= 'none';document.getElementById('transfer').style.d isplay='none';document.getElementById('owndomain') .style.display='';document.getElementById('subdoma in').style.display='none';document.getElementById( 'incart').style.display='none'" /> <label for="selowndomain">{$LANG.orderdomainoption2}</label><br />
{/if}
{/if}
Hope this is handy :)

Zorro67
12-10-08, 10:14 PM
Thnaks for the code. Would this work if you are talking about a product group, or multiple groups?

eg
{if $gid neq '#GROUPID#'}
or
{if $gid neq '#GROUPID#1' or $gid neq '#GROUPID#2'}

AeonCube
12-11-08, 01:50 PM
@Zorro67
Sorry to say the group ID does not get passed through the URL. The only way would to have the group ID to be posted through a form or the URL.
This could be done but would require some code changes to the other order pages. If you would like for me to code this for just send me a PM.

Zorro67
12-11-08, 09:26 PM
Thanks, you are right. I tested this against our setup but configureproductdomain.tpl doesn't have the group ID passed to it.

This is indicative of other opportunities for customisation. How to pass a standard variable from one page to another?

(i'm not a coder by the way).

Thanks for the offer, I'll PM you on this topic

tony47ch
12-27-08, 02:28 AM
nice to meet you all.

webRulon
02-05-09, 07:47 AM
Is there a way to do this trick for multiple products by passing multiple product ids in the code?

subn3t
01-13-10, 05:34 PM
When you force someone to register/transfer domain with one of the products, user can always delete the domain from the cart and order only the product. How do you fix this ?