Jump to content

Domain price list..


sburns1992

Recommended Posts

Hey,

I know this has been requested a couple of times, but it was in the past and the database table names have changed since.

 

Could someone please provide me with code to display my Domain Extension and Pricing (Register, Renew, Transfer) in a html table, so that when I update my pricing it will automatically update the page so that I don't have to update the prices all manually.

 

 

Thanks,

Scott.

Link to comment
Share on other sites

  • WHMCS CEO

Hi,

 

Domain pricing is stored in the tblpricing table along with the prices for products, addons and everything else sold through your WHMCS installation. So to display pricing information for domains on your site you would need to query that table for the type fields of domainregister, domaintransfer and domainrenew where relid=tbldomainpricing.id to correspond to the TLD you want to show and currency = the tblcurrencies currency ID that you want to retrieve and display (default 1). Then it's simply a case of the 10 amount fields returned from that query are the prices from years 1 to 10 respectively.

 

Matt

Link to comment
Share on other sites

The SQL query isn't the prettiest, but it will do the trick (don't blame me, it's from our test archive ;)).

It will only show the pricing for new registrations, but use a little magic and you can display the ones for transfers and renewing.

A very basic script, so edit where needed.

 

<?php
$link = mysql_connect("localhost", "sql-user", "sql-pass") or die("MySQL Error: ".mysql_error());
mysql_select_db("sql-database", $link) or die("MySQL Error: ".mysql_error());

$result = mysql_query("SELECT
   tblpricing.currency,
   tblpricing.msetupfee, tblpricing.qsetupfee, tblpricing.ssetupfee, tblpricing.asetupfee, tblpricing.bsetupfee, tblpricing.monthly, tblpricing.quarterly, tblpricing.semiannually, tblpricing.annually, tblpricing.biennially, 
   (SELECT tblcurrencies.prefix FROM tblcurrencies WHERE id = tblpricing.currency) AS curprefix,
   (SELECT tblcurrencies.suffix FROM tblcurrencies WHERE id = tblpricing.currency) AS cursuffix,
   (SELECT tbldomainpricing.extension FROM tbldomainpricing WHERE id = tblpricing.relid) AS extension
FROM 
   tblpricing
WHERE 
   tblpricing.type= 'domainregister'
AND
   !(SELECT tbldomainpricing.extension FROM tbldomainpricing WHERE id = tblpricing.relid)");

   echo "    <div style=\" display: block;\">
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">Extension</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">1 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">2 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">3 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">4 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">5 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">6 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">7 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">8 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">9 year</div>
       <div style=\"display: table-cell; width: 100px; font-weight: bold;\">10 year</div>
   </div>\n";

while($row = mysql_fetch_array($result))
   echo "    <div style=\"display: block;\">
       <div style=\"display: table-cell; width: 100px;\">".$row['extension']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['msetupfee']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['qsetupfee']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['ssetupfee']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['asetupfee']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['bsetupfee']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['monthly']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['quarterly']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['semiannually']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['annually']." ".$row['cursuffix']."</div>
       <div style=\"display: table-cell; width: 100px;\">".$row['curprefix']." ".$row['biennially']." ".$row['cursuffix']."</div>
   </div>\n";

mysql_close($link);
?>

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 2 years later...
there is no snippets of code on this page

 

Read the page again. Dont skim...read.

 

"Looking for a way to get product/domain info & pricing on your site? The functionality for doing that previously referred to as widgets has now been renamed to Data Feeds".

 

So go back and click on the link "Data Feeds" and VOILA!!! you will see snippets.

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