Jump to content

Only offer subdomain for a certain product


evocartuk

Recommended Posts

I have created a free trial product but the only domain option I want to show is for sub domains. But as I want options to buy a doamin etc for other services its also showing on the free product.

 

WHMCS support did say...

 

"To do this, you would need to edit the configureproductdomain.tpl file in your active orderform template directory and check the product being ordered.

 

Something like:

 

{if $pid neq 5}show domain options 1, 2 , 3{/if}"

 

But can't seem to get this to work, my product number is 38 I believe, so I replaced "5" with 38 but not even sure if I am doing that right. I also removed options 1, 2 but that didnt seem to help.

 

Any suggestions?

Link to comment
Share on other sites

exactly how to do this will depend on your order form template - though I think all the default ones are quite similar and you only have to change the {if} statement, so whatever is after that shouldn't matter.

 

in configureproductdomain.tpl, there will be an {if} similar to below:

 

{if $subdomains}

what you will need to do is edit that so that it is only used with your specific product...

 

{if $subdomains and $productinfo.pid eq "38"}

now, product 38 should have subdomain options, the other products shouldn't.

 

just remember to ensure that the product group is using the specific order form you're editing... if your other products are using a different order form, and you haven't modified it to prevent subdomains, then they will still be an option with those products.

Link to comment
Share on other sites

Its not the subdomain part that is the issue, as you choose them by product, I want to stop...

 

I want MySite to register a new domain for me.

I want to transfer my domain to MySite

I will update my nameservers on an existing domain Or I will register a new domain.

 

from displaying for product 38 so that ONLY subdomain option is visible.

 

Hope that makes sense.

Link to comment
Share on other sites

sorry, I'm still powered down from Christmas and not upto full mental capacity yet! :)

 

to do what you want to do, change the following opening {if} statements in configureproductdomain.tpl from...

 

{if $incartdomains}
{if $registerdomainenabled}
{if $transferdomainenabled}
{if $owndomainenabled}

to...

{if $incartdomains and $productinfo.pid neq "38"}
{if $registerdomainenabled and $productinfo.pid neq "38"} 
{if $transferdomainenabled and $productinfo.pid neq "38"} 
{if $owndomainenabled and $productinfo.pid neq "38"}

so for product 38, only subdomains should be shown as an option, for all other products using this order form, the other domain options should be available.

Link to comment
Share on other sites

Thank you so much, that worked a treat.

 

I don't supose you know if its possible to keep the subdomain button ticked for that product? If not then no worries its hardly difficoult for them to do it, its just that I'm going to "attempt" creating a basic free trial signup form on my homepage whch will have fields such as "first name", "Surname", "email address" and "subdomain" then i'm hoping I can create a "signup" button that will passes the information onto the WHMCS form, but go straight to the registration form so that the customer doesn't have to go via the subdomain page of the cart.

 

Just thought the tick box thing may stop this from working if they have to manually choose the domain type even if there is only one option.

 

Thanks again.

Link to comment
Share on other sites

  • 2 months later...
how to make the subdomain button ticked by default ?

easiest may would be to change the order they're shown - the first (top) will always be ticked by default...

 

the link below might help...

 

http://forum.whmcs.com/showthread.php?86146-Customization-of-Checkout-Process&p=365570#post365570

 

in your case, move your subdomains block of code up to be the first of the options.

 

{if $subdomains}
...
{/if} 

Link to comment
Share on other sites

Soryy .. i can't get it .. please can you help me ! please help me to edit this code .. im using vertical steps

 

<link rel="stylesheet" type="text/css" href="templates/orderforms/{$carttpl}/style.css" />

<div id="order-verticalsteps">

{include file="orderforms/verticalsteps/verticalsteps.tpl" step=2}

<div class="maincontent">

<h1>{$productinfo.groupname} - {$productinfo.name}</h1>

<p>{$LANG.cartproductdomaindesc}</p>

<form method="post" action="{$smarty.server.PHP_SELF}?a=add&pid={$pid}">
{foreach from=$passedvariables key=name item=value}
<input type="hidden" name="{$name}" value="{$value}" />
{/foreach}

{if $errormessage}<div class="errorbox">{$errormessage|replace:'<li>':'  #  '}  #  </div><br />{/if}

<div class="domainoptions">
{if $subdomains}
<div><label><input type="radio" name="domainoption" value="subdomain" id="selsubdomain" onclick="document.getElementById('register').style.display='none';document.getElementById('transfer').style.display='none';document.getElementById('owndomain').style.display='none';document.getElementById('subdomain').style.display='';document.getElementById('incart').style.display='none'" /> {$LANG.orderdomainoption4}</label></div>
{/if}

{if $incartdomains and $productinfo.pid neq "10"}
<div><label><input type="radio" name="domainoption" value="incart" id="selincart" onclick="document.getElementById('register').style.display='none';document.getElementById('transfer').style.display='none';document.getElementById('owndomain').style.display='none';document.getElementById('subdomain').style.display='none';document.getElementById('incart').style.display=''" /> {$LANG.cartproductdomainuseincart}</label></div>
{/if}

{if $registerdomainenabled and $productinfo.pid neq "10"}  
<div><label><input type="radio" name="domainoption" value="register" id="selregister" onclick="document.getElementById('register').style.display='';document.getElementById('transfer').style.display='none';document.getElementById('owndomain').style.display='none';document.getElementById('subdomain').style.display='none';document.getElementById('incart').style.display='none'" /> {$LANG.orderdomainoption1part1} {$companyname} {$LANG.orderdomainoption1part2}</label></div>
{/if}

{if $transferdomainenabled and $productinfo.pid neq "10"} 
<div><label><input type="radio" name="domainoption" value="transfer" id="seltransfer" onclick="document.getElementById('register').style.display='none';document.getElementById('transfer').style.display='';document.getElementById('owndomain').style.display='none';document.getElementById('subdomain').style.display='none';document.getElementById('incart').style.display='none'" /> {$LANG.orderdomainoption3} {$companyname}</label></div>
{/if}

{if $owndomainenabled and $productinfo.pid neq "10"} 
<div><label><input type="radio" name="domainoption" value="owndomain" id="selowndomain" onclick="document.getElementById('register').style.display='none';document.getElementById('transfer').style.display='none';document.getElementById('owndomain').style.display='';document.getElementById('subdomain').style.display='none';document.getElementById('incart').style.display='none'" /> {$LANG.orderdomainoption2}</label></div>
{/if}


</div>

<div class="orderbox">

<div id="incart" align="center">{$LANG.cartproductdomainchoose}: <select name="incartdomain">
{foreach key=num item=incartdomain from=$incartdomains}
<option value="{$incartdomain}">{$incartdomain}</option>
{/foreach}
</select>
</div>

<div id="register" align="center">www. <input type="text" name="sld[0]" size="40" value="{$sld}" /> <select name="tld[0]">
{foreach key=num item=listtld from=$registertlds}
<option value="{$listtld}"{if $listtld eq $tld} selected="selected"{/if}>{$listtld}</option>
{/foreach}
</select>
</div>

<div id="transfer" align="center">www. <input type="text" name="sld[1]" size="40" value="{$sld}" /> <select name="tld[1]">
{foreach key=num item=listtld from=$transfertlds}
<option value="{$listtld}"{if $listtld eq $tld} selected="selected"{/if}>{$listtld}</option>
{/foreach}
</select>
</div>

<div id="owndomain" align="center">www. <input type="text" name="sld[2]" size="40" value="{$sld}" /> . <input type="text" name="tld[2]" size="7" value="{$tld}" /></div>

<div id="subdomain" align="center">http:// <input type="text" name="sld[3]" size="40" value="{$sld}" /> <select name="tld[3]">{foreach from=$subdomains key=subid item=subdomain}<option value="{$subid}">{$subdomain}</option>{/foreach}</select></div>

</div>

<script language="javascript" type="text/javascript">
document.getElementById('incart').style.display='none';
document.getElementById('register').style.display='none';
document.getElementById('transfer').style.display='none';
document.getElementById('owndomain').style.display='none';
document.getElementById('subdomain').style.display='none';
document.getElementById('sel{$domainoption}').checked='true';
document.getElementById('{$domainoption}').style.display='';
</script>

{if $availabilityresults}

<h2>{$LANG.choosedomains}</h2>

<table class="styled textcenter">
<tr><th>{$LANG.domainname}</th><th>{$LANG.domainstatus}</th><th>{$LANG.domainmoreinfo}</th></tr>
{foreach key=num item=result from=$availabilityresults}
<tr><td>{$result.domain}</td><td class="{if $result.status eq $searchvar}textgreen{else}textred{/if}">{if $result.status eq $searchvar}<input type="checkbox" name="domains[]" value="{$result.domain}"{if $num eq 0} checked{/if} /> {$LANG.domainavailable}{else}{$LANG.domainunavailable}{/if}</td><td>{if $result.regoptions}<select name="domainsregperiod[{$result.domain}]">{foreach key=period item=regoption from=$result.regoptions}{if $regoption.$domainoption}<option value="{$period}">{$period} {$LANG.orderyears} @ {$regoption.$domainoption}</option>{/if}{/foreach}</select>{/if}</td></tr>
{/foreach}
</table>

{/if}

{if $freedomaintlds}* <em>{$LANG.orderfreedomainregistration} {$LANG.orderfreedomainappliesto}: {$freedomaintlds}</em>{/if}

<p align="center"><input type="submit" value="{$LANG.ordercontinuebutton}" /></p>

</form>

</div>

</div> 

Link to comment
Share on other sites

with verticalsteps, you can leave configureproduct.tpl unchanged from the default order... but in products.tpl, you can change the following line...

 

<form method="post" action="{$smarty.server.PHP_SELF}?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}">

and tell it to use subdomain by default...

 

<form method="post" action="{$smarty.server.PHP_SELF}?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}&domainoption=subdomain">

this will work if the product selected has a subdomain option; if it doesn't, then no option will be pre-selected.

 

unfortunately, at step 1 I don't think there is a simple way of finding out if the selected product has a subdomain option - apart from querying the db...

 

however, as per previous solutions, if you only want to automate this subdomain choice for specific products, you could specify them in an if statement..

 

<form method="post"  action="{$smarty.server.PHP_SELF}?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}{if $product.pid eq "38"}&domainoption=subdomain{/if}">

Link to comment
Share on other sites

sorry .. i can't make this done .. so i changed my orderform to web20cart .. and my problem that in the free product i cant make the subdomain is ticked by default

this my domainconfig

<div class="domainoptions">

 

{if $subdomains and $productinfo.pid eq "10"}

<div><label><input type="radio" name="domainoption" value="subdomain" id="selsubdomain" onclick="document.getElementById('register').style.display='none';document.getElementById('transfer').style.display='none';document.getElementById('owndomain').style.display='none';document.getElementById('subdomain').style.display='';document.getElementById('incart').style.display='none'" /> {$LANG.orderdomainoption4}</label></div>

{/if}

 

{if $incartdomains and $productinfo.pid neq "10"}

<div><label><input type="radio" name="domainoption" value="incart" id="selincart" onclick="document.getElementById('register').style.display='none';document.getElementById('transfer').style.display='none';document.getElementById('owndomain').style.display='none';document.getElementById('subdomain').style.display='none';document.getElementById('incart').style.display=''" /> {$LANG.cartproductdomainuseincart}</label></div>

{/if}

 

{if $registerdomainenabled and $productinfo.pid neq "10"}

<div><label><input type="radio" name="domainoption" value="register" id="selregister" onclick="document.getElementById('register').style.display='';document.getElementById('transfer').style.display='none';document.getElementById('owndomain').style.display='none';document.getElementById('subdomain').style.display='none';document.getElementById('incart').style.display='none'" /> {$LANG.orderdomainoption1part1} {$companyname} {$LANG.orderdomainoption1part2}</label></div>

{/if}

 

{if $transferdomainenabled and $productinfo.pid neq "10"}

<div><label><input type="radio" name="domainoption" value="transfer" id="seltransfer" onclick="document.getElementById('register').style.display='none';document.getElementById('transfer').style.display='';document.getElementById('owndomain').style.display='none';document.getElementById('subdomain').style.display='none';document.getElementById('incart').style.display='none'" /> {$LANG.orderdomainoption3} {$companyname}</label></div>

{/if}

 

{if $owndomainenabled and $productinfo.pid neq "10"}

<div><label><input type="radio" name="domainoption" value="owndomain" id="selowndomain" onclick="document.getElementById('register').style.display='none';document.getElementById('transfer').style.display='none';document.getElementById('owndomain').style.display='';document.getElementById('subdomain').style.display='none';document.getElementById('incart').style.display='none'" /> {$LANG.orderdomainoption2}</label></div>

{/if}

Link to comment
Share on other sites

you can use my idea from post 10 and modify web20cart/products.tpl at line 58 by changing...

 

<td width="20%" class="textcenter"><input type="button" value="{$LANG.ordernowbutton}"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}'" /></td>

to...

 

<td width="20%" class="textcenter"><input type="button" value="{$LANG.ordernowbutton}"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}{if $product.pid eq "10"}&domainoption=subdomain{/if}'" /></td>

this will automatically tick the subdomain option for product #10

 

... and if you haven't done so already, remember to add the subdomain option to the product in the other -> subdomain options link.

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