Jump to content

Domain registration period drop-down


northfork

Recommended Posts

Hi,

On the domains configuration page during checkout I'm wanting to add a drop-down registration period field which would allow folks to register the domain for additional years. Currently it's set to whatever you selected on the previous register domain page. I grabbed this code from domainoptions.tpl and added it to configuredomains.tpl - the drop-down field showed up but no pricing.

 

<div class="text-center">
               {if count($searchResults.pricing) == 1}
                   <p class="margin-bottom">{$LANG.orderForm.domainAddedToCart}</p>
                   <button type="button" class="btn btn-default btn-lg margin-bottom">
                       <span class="glyphicon glyphicon-shopping-cart"></span>
                       {$searchResults.shortestPeriod.register}
                   </button>
               {else}
                   <p class="margin-bottom">{$LANG.orderForm.registerLongerAndSave}</p>
                   <div class="btn-group btn-group-lg margin-bottom">
                       <button type="button" class="btn btn-default btn-sm">
                           <span name="{$searchResults.domainName}-selected-price">
                               <b class="glyphicon glyphicon-shopping-cart"></b>
                               {$searchResults.shortestPeriod.period} {$LANG.orderyears} @ {$searchResults.shortestPeriod.register}
                           </span>
                       </button>
                       <button type="button" class="btn btn-default btn-sm dropdown-toggle additional-options" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                           <b class="caret"></b>
                           <span class="sr-only">
                               {lang key="domainChecker.additionalPricingOptions" domain=$searchResults.domainName}
                           </span>
                       </button>
                       <ul class="dropdown-menu" role="menu">
                           {foreach $searchResults.pricing as $years => $price}
                               <li>
                                   <a href="#" onclick="selectDomainPricing('{$searchResults.domainName}', '{$price.register}', {$years}, '{$LANG.orderyears}');return false;">
                                       <b class="glyphicon glyphicon-shopping-cart"></b>
                                       {$years} {$LANG.orderyears} @ {$price.register}
                                   </a>
                               </li>
                           {/foreach}
                       </ul>
                   </div>
               {/if}
           </div>

 

Any ideas on how this can be done?

 

Thanks

Link to comment
Share on other sites

Any ideas on how this can be done?

not easily.

 

not all pages have access to the same variables - configuredomains.tpl doesn't have access to the pricing arrays, so you won't be able to directly display any TLD pricing... you would probably need to query the database to get the TLD pricing using an action hook.

 

even then, there are no guarantees that copying code from one template would work when pasted into another.

Link to comment
Share on other sites

That stinks, I didn't realize this.

 

Is there an alternative that I'm not thinking of? Seems strange that a customer wouldn't be able to change the domain registration period during the checkout process. People change their mind all the time and allowing them to go back and either increase or decrease the period makes sense to me.

 

Am I missing something / another way?

Link to comment
Share on other sites

That stinks, I didn't realize this.

 

Seems strange that a customer wouldn't be able to change the domain registration period during the checkout process. People change their mind all the time and allowing them to go back and either increase or decrease the period makes sense to me.

there are lots of ways WHMCS works that doesn't make any sense - but you get used to them after a while. :)

 

the cart process is pretty much hard-coded and I don't think has changed much since i've been using it - yes, the templates have been updated, but the process behind them remains the same... so there is a limit on the modifications you can make (and still have the cart function correctly).

 

what you suggest makes sense - but off the top of my head, I can't recall another post asking about this... even had a quick look in the requests forum, but couldn't find anyone asking for this there either.

 

Am I missing something / another way?

the first thing to find out is whether the above code works when pasted into the template - ignore that the pricing is missing for now, can you successfully change the domain registration period using that code?

 

if you can successfully change it, then you have options - the action hook being one... perhaps using a data feed to show the pricing for that domain (which i'm sure i've posted in user contributions) - not sure if you'd have access to the TLD value, but there would be ways around that..

Link to comment
Share on other sites

nope - no go. You're right Brian nothing changed when adding the above code. configuredomains.tpl seems to be pretty limited.

 

I put in a feature request as you suggested a few days ago but it's still "On Moderation" mode so who knows if it will get published :)

 

Anyway not to go around in circles but I did a quick test with other companies and it's pretty much industry standard: Godaddy, Media Temple, Hostgator, Namecheap, Hover (tucows), they all allow for this as well as seeing the price change "order summary".

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.

×
×
  • 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