Jump to content
Sign in to follow this  
wyatt121

domain suggestion tool

Recommended Posts

Hi,

 

Has anyone built a domain name suggestion tool into WHMCS? I think I read that someone has already done it with Enom/Name Spinner. Yet, I use OpenSRS. I think it would be a cool WHMCS module to be added. A universal domain suggestion tool that works with all registrars, uses Ajax for real time look ups, and gives great results.

 

If this does not exist, or no body wants to build it... if I paid someone to write it for me, could I easily integrate into WHMCS? Would someone at WHMCS be interested in writing it for me for a price?

 

Anyone have any ideas on how I can get this accomplished the best way with OpenSRS?

 

It seems there are a lot of OpenSRS resellers in this forum that are hoping for tighter integration. Is WHMCS interested in tightening their integration with the OpenSRS platform?

 

Regards,

 

Wyatt

Share this post


Link to post
Share on other sites

Sorry, I should have given instructions, my bad.

 

1. Create a new file in the whmcs root directory specifying namespinner as the template name - see the whmcs docs on creating pages, this doesnt really do anything, just displays the template.

 

2. Create a form with a textfield called searchstr, with the form action pointing to the new namespinner.php page you created.

 

3. Modify the namespinner.tpl page and put in your own opensrs reseller details.

 

 

Sequence -

 

Form posts searchstr value to namespinner.php (which doesnt do anything, only displays the template)

 

namespinner template file gets the posted search string and uses the opensrs domain_suggest api method to return the results.

 

If anything is unclear just let me know.

Share this post


Link to post
Share on other sites

Hello. I seem to be getting an error when I set this up. Maybe someone knows how to resolve this:

 

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found in /var/www/vhosts/customer/data/templates_c/%%DE^DE3^DE3C3394%%namespinner.tpl.php on line 117

 

Warning: simplexml_load_string() [function.simplexml-load-string]: l version='1.0' encoding="UTF-8" standalone="no" ?> in /var/www/vhosts/customer/data/templates_c/%%DE^DE3^DE3C3394%%namespinner.tpl.php on line 117

 

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /var/www/vhosts/customer/data/templates_c/%%DE^DE3^DE3C3394%%namespinner.tpl.php on line 117

 

Warning: Invalid argument supplied for foreach() in /var/www/vhosts/customer/data/templates_c/%%DE^DE3^DE3C3394%%namespinner.tpl.php on line 126

Share this post


Link to post
Share on other sites

So, after some more poking, I think these errors are either harmless or related to the lack of response from the OpenSRS API. It seems that Bill may be having the same problem as his form (http://www.register-domain-names.com/index.php) doesn't produce any results either.

 

Bill, do you have any ideas?

 

 

Hello. I seem to be getting an error when I set this up. Maybe someone knows how to resolve this:

Share this post


Link to post
Share on other sites

Started to do my own diagnostic, and it seems that I am actually authenticating with OpenSRS and actually getting a result. The namespinner.tpl is just not able to correctly parse the XML. It looks like it is choking on this line:

 

$lookups = $spinnerresults->body->data_block->dt_assoc->item[4]->dt_assoc->item->dt_assoc->item[4]->dt_array->item;

 

I'm thinking that OpenSRS may have changed the XML format and this is no longer finding relevant results. I'm not fluent in XML, so it may take a bit to figure this out. If anyone knows how to parse XML, let me know what may be wrong.

Share this post


Link to post
Share on other sites

Ok, so I figured it out. There may have been a change to the XML response by OpenSRS. Here is the change:

 

From:

$lookups = $spinnerresults->body->data_block->dt_assoc->item[4]->dt_assoc->item->dt_assoc->item[4]->dt_array->item;

 

To:

$lookups = $spinnerresults->body->data_block->dt_assoc->item[5]->dt_assoc->item->dt_assoc->item[4]->dt_array->item;

 

Now the foreach doesn't error and it completes the request and displays the name suggestions as expected.

 

-Eric

Share this post


Link to post
Share on other sites

Thanks Eric, I just got to the same conclusion and was about to post here when I noticed you already found the error, yes it looks like opensrs change the api format slightly, for anyone using this code please implement the fix:

 

Change the following code in namspinner.tpl

 

From:

$lookups = $spinnerresults->body->data_block->dt_assoc->item[4]->dt_assoc->item->dt_assoc->item[4]->dt_array->item;

 

To:

$lookups = $spinnerresults->body->data_block->dt_assoc->item[5]->dt_assoc->item->dt_assoc->item[4]->dt_array->item;

 

Thanks to efisher for the fix.

Share this post


Link to post
Share on other sites

I keep searching for the ajax domain searches and form integration scripts.

 

We want to keep our potential customers on one screen with one form. We would like for them to be able to type in their desired domain and get a "check" or a "green light" if they can use it.

 

It would be validated upon submission.

 

Still no luck.

Share this post


Link to post
Share on other sites

Got this working, but I have one small issue. This code displays pricing in GBP apparently

and this is the only code that will do that on the site, so I assume it's hardcoded, but for the life of me I haven't been able to figure out where in the code to fix it.

 

I have a feeling this was coded before the multi-currency was added to WHMCS?

 

Any ideas how to fix this?

Share this post


Link to post
Share on other sites

installing this mod on WHMCS 4.21 produces the following error as well

 

namespinner.tpl line 179]: [plugin] modifier 'lower' is not implemented (core.load_plugins.php, line 118) in /includes/smarty/Smarty.class.php on line 1093

Edited by usadomains
adding code tags

Share this post


Link to post
Share on other sites

Not sure why all of the default plugins for Smarty are not loaded, there are a few worthwhile modifiers missing.... For those who want to take a look, here is the link to the download the current version of smarty (which is the same version used in 4.2.1) and all you need to do is copy the modifier.*.php files from the Smarty-2.6.26\libs\plugins directory (from the zip file) into your WHMCS/includes/smarty/plugins directory...

Share this post


Link to post
Share on other sites

Just rechecked my 4.2.1 download, and I can confirm that file wasn't part of the distribution.

 

Now why it's pulling the GBP pricing has me stumped. We do have 4 currency's setup, with USD as the default. Everything else of the site works properly, except this script.

 

Anyone have a fix or willing to take a look at the zip file and update it?

Share this post


Link to post
Share on other sites

Should i assume this is what us opensrs people are using now, i dont see this has been added as a feature to whmcs.

Share this post


Link to post
Share on other sites

OK i got this working but you dont have to upload any new modifer to the smarty folder.

 

All you have to do is use the strtolower function in your form.

 

The original shows this.

 

<td><input type="checkbox" name="domains[]" value="{$result.domain|lower}" /> {$LANG.domainavailable}</td>

<td><select name="domainsregperiod[{$result.domain|lower}]" style="width:175px;">

 

Which bombs out because it does not recognize the "lower" attribute.

 

So just change it like this, very easy.

 

<td><input type="checkbox" name="domains[]" value="{$result.domain|strtolower}" /> {$LANG.domainavailable}</td>

<td><select name="domainsregperiod[{$result.domain|strtolower}]" style="width:175px;">

 

works great. For me i created a html file that fit my site look, put the form inside of that, which calls the php file, and then put the php file inside my whmcs dir (with my info inside) then put the tpl file in my template folder and whala works great. Even carries the name selected all the way thru the order process.

 

I just have to decide if i want to keep the check for login that exists in the whmcs sample code, i dont think i need that, i should be able to just remove that section all together.

 

Very nice job bill.

 

Thanks billchalmers :)

Share this post


Link to post
Share on other sites

A few improvements i am working on. Get more results, min of 50 would be better. Possibly have a pagination (not sure with 50 results) just thinking. And being able to isolate which tld i want to search for. No sense in showing any of the others if thats not what i want to focus on.

Share this post


Link to post
Share on other sites

Ok i have made some improvements and able to do both mixed and individual tlds, anyone interested in checking this out?

Share this post


Link to post
Share on other sites

i am not an expert on xml i think i just change this to 50 for more replys,

<item key='maximum'>25</item>

but not sure, it bombed on me when i changed this when testing and gave up on that idea, not a big deal.

 

Anyway it seems to work, there are some tlds that it is not compatable with in the look up, im not sure if that is my registrar or the script but when looking up .ca and .co.uk and .tv it blew up and the xml showed inside that those tlds were not compatable.

 

The only compatable tlds are what is in my form.

 

I limited the input to 50 chars, if they cant come up with a name in 50 chars they are sad lmao. :)

 

You may have to tweak the tpl a bit for your template but process wize its sound i do believe. If anyone sees anything let me know im sure that all together we can all come with something really grand.

 

There are three files,

suggest.html - just a form page, change the action of the form to where your whmcs is. This goes in your website root.

 

suggest_name.php which is just the file to display the page just as bill had mentioned - all i did was take out the check if login part and add some text documentation. This file goes in your root whmcs folder.

 

namespinner.tpl This is the meat of the process - there is internal doc. The original did not verify if no results of query so it still showed the add to cart stuff with no results, and did not sanitize, i did fix both items and also added some checks and balances. It should be well documented. Just put your opensrs stuff in the top of this file where instructed just like the orig file was. This file goes in your template folder.

 

Thats it. Check it out and let me know. If you have improvments, make them and post the result here with explanation please. We got this process for free so lets continue to give the better versions for free please, let's give back.

 

Thanks.

 

Here is the zip. :)

namespinner_improved050312.zip

Edited by durangod

Share this post


Link to post
Share on other sites

I forgot to mention in the suggest_name.php file youll have to change this breadcrumb if your not doing an html file.

 

$breadcrumbnav .= ' > <a href="../suggest.html">Suggest Name Tool</a>'; 

Share this post


Link to post
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.

Sign in to follow this  

  • 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