Jump to content

Easy eNom TLD Importer


scottcase

Recommended Posts

here is an easy way to import your TLD's and pricing directly from your enom reseller account.

 

make sure you have updated your "Retail" pricing at enom.

 

<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");

if($_POST[action]=='')
{
?>
<form method="post">
<input name="action" value="doimport" type="hidden" />
<input name="enU" type="text" />eNom Username<br />
<input name="enP" type="text" />eNom Password<br />
<br />
<input name="Submit1" type="submit" value="submit" />
</form>
<?
}else{
$url = "http://reseller.enom.com/interface.asp?command=PE_GetRetailPricing&uid={$_POST[enU]}&pw={$_POST[enP]}&responsetype=xml";

$rss =  simplexml_load_file($url);

//truncate tbldomainpricing
mysql_query("truncate table tbldomainpricing");

//remove all TLD data from tblpricing table
mysql_query("DELETE FROM `tblpricing` WHERE type='domainregister'");
mysql_query("DELETE FROM `tblpricing` WHERE type='domaintransfer'");
mysql_query("DELETE FROM `tblpricing` WHERE type='domainrenew'");

//now insert eNom Data
$i=0;
foreach ($rss->pricestructure->tld as $item) {
//first insert into tbldomainpricing
$query="INSERT INTO `tbldomainpricing` (`id` ,`extension` ,`dnsmanagement` ,`emailforwarding` ,`idprotection` ,`eppcode` ,`autoreg` ,`order`)
VALUES (NULL , '." . $item->tld . "', '', '', '', '', 'enom', '$i');";
mysql_query($query);
$relid = mysql_insert_id();

//now insert into tblpricing
$query="INSERT INTO `tblpricing` (`id` ,`type` ,`currency` ,`relid` ,`msetupfee` ,`qsetupfee` ,`ssetupfee` ,`asetupfee` ,`bsetupfee` ,`tsetupfee` ,`monthly` ,`quarterly` ,`semiannually` ,`annually` ,`biennially` ,`triennially` )
VALUES (NULL , 'domainregister', '1', '$relid', '" . $item->registerprice . "', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00')";
mysql_query($query);
$query="INSERT INTO `tblpricing` (`id` ,`type` ,`currency` ,`relid` ,`msetupfee` ,`qsetupfee` ,`ssetupfee` ,`asetupfee` ,`bsetupfee` ,`tsetupfee` ,`monthly` ,`quarterly` ,`semiannually` ,`annually` ,`biennially` ,`triennially` )
VALUES (NULL , 'domaintransfer', '1', '$relid', '" . $item->transferprice . "', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00')";
mysql_query($query);
$query="INSERT INTO `tblpricing` (`id` ,`type` ,`currency` ,`relid` ,`msetupfee` ,`qsetupfee` ,`ssetupfee` ,`asetupfee` ,`bsetupfee` ,`tsetupfee` ,`monthly` ,`quarterly` ,`semiannually` ,`annually` ,`biennially` ,`triennially` )
VALUES (NULL , 'domainrenew', '1', '$relid', '" . $item->renewprice . "', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00')";
mysql_query($query);


 echo "TLD: ." . $item->tld . "  Register: " . $item->registerprice . "  Transfer: " . $item->transferprice . "  Renew: " . $item->renewprice . "  Inserted Into Database<br>";
 $i++;
}

}
?>

 

just add this to a php file, upload it to the whmcs/modules/admin/ directory and access it from utilities -> addon modules.

 

 

It only inserts pricing for the 1 year option, but that is all that i needed it to do.

 

Feel free to customize it to your needs

 

 

I have attached a zip file also

 

 

 

 

Scott

enom_tld_importer.zip

Link to comment
Share on other sites

  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

  • 4 weeks later...
  • 2 weeks later...
Has anyone done the other options- 2 years... up to 10 years? That would be really helpful!

 

Here you go! It took a bit, but it works like a charm. It can populate over 2500 fields in less than 10 seconds!

 

- Uses CURL instead of simplexml_load_file

- You can select if you want to delete the existing records in the database first

(if you do not, there probably will be duplicates)

- You can select to import 1 year prices

- You can select to import 2-4 year prices

- You can select to import 5-9 year prices

- You can select to import 10 year prices

- Automatically ads -1 to disabled fields

 

BACKUP FIRST!!!

Link to comment
Share on other sites

Updated version:

 

- Round up/down to the nearest dollar while importing

- Price changer - change all register and/or transfer and/or renew prices from xx.xx to zz.zz

 

Price changer can be used indepenently of the import functions.

 

 

.

enom_import.jpg

Link to comment
Share on other sites

  • 3 weeks later...

Clever stuff going on here. I downloaded the file and followed what seemed idiot proof instructions.

 

upload it to the whmcs/modules/admin/ directory and access it from utilities -> addon modules.

 

Done all that but no sign of anything in the addon modules menu. Have I missed something?

using latest version of WHMCS.

 

Any top tips much appreciated.

Link to comment
Share on other sites

If you look at the folder structure in the /modules/admin/ folder, you will see other folders inside.

 

Create a folder in /modules/admin/ called enom_tld_importer and upload the file into that folder.

 

/modules/admin/enom_tld_importer/ <- File goes in here.

Link to comment
Share on other sites

Thanks for reply. Yes I checked the layout of the existing "add ons" and had done as you suggest. Still nothing showing up in the add ons menu. Just having a look at the script to see if having a custom named main ADMIN folder, as prompted at initial WHMCS set up, would affect it.

Edited by letsgetmotivated
Link to comment
Share on other sites

Put this in your browser's address bar and see what the results are. Replace USERNAME/PASSWORD with your Enom username and password.

 

http://reseller.enom.com/interface.asp?command=PE_GetRetailPricing&TLDOnly=1&years=1&uid=USERNAME&pw=PASSWORD&responsetype=xml

 

You should have some XML returned in the browser.

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
  • 3 weeks later...

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