sburns1992 Posted October 18, 2010 Share Posted October 18, 2010 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. 0 Quote Link to comment Share on other sites More sharing options...
sburns1992 Posted October 19, 2010 Author Share Posted October 19, 2010 Can anyone help at all? 0 Quote Link to comment Share on other sites More sharing options...
WHMCS CEO Matt Posted October 19, 2010 WHMCS CEO Share Posted October 19, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
sburns1992 Posted October 19, 2010 Author Share Posted October 19, 2010 Hey Matt thanks for the reply, I understand that I would need to query the database, but I am unsure how to write that out, I'm not very good with coding with mysql... Could you help? Thanks, Scott. 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted October 19, 2010 Share Posted October 19, 2010 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); ?> 0 Quote Link to comment Share on other sites More sharing options...
sburns1992 Posted October 19, 2010 Author Share Posted October 19, 2010 Excellent, thank you Kind of works, but slightly strange, ha... http://clients.burnsy.co.uk/testingdatabase.php 0 Quote Link to comment Share on other sites More sharing options...
Sajad Posted January 3, 2011 Share Posted January 3, 2011 It's very good.... How can change price format ? It's 123456789.00 i want change to 123.456.789 please help me... tnx 0 Quote Link to comment Share on other sites More sharing options...
nasos75 Posted January 3, 2011 Share Posted January 3, 2011 Check here: http://www.php.net/manual/en/function.number-format.php 0 Quote Link to comment Share on other sites More sharing options...
ninak Posted January 3, 2011 Share Posted January 3, 2011 Wouldn't it be easier just to use the whmc domain widget on your html page? 0 Quote Link to comment Share on other sites More sharing options...
craigedmonds Posted February 19, 2011 Share Posted February 19, 2011 Wouldn't it be easier just to use the whmc domain widget on your html page? Thank Ninak...good one. The domain widgets IS the best option in this case. Quick snippets of code produces a nice table of domains. http://wiki.whmcs.com/Widgets#Domain_Pricing_Table 0 Quote Link to comment Share on other sites More sharing options...
northgate Posted June 25, 2013 Share Posted June 25, 2013 there is no snippets of code on this page 0 Quote Link to comment Share on other sites More sharing options...
craigedmonds Posted June 25, 2013 Share Posted June 25, 2013 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. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.