jbougeno
06-19-08, 06:23 AM
Note: The following only works if your Joomla site resides on the same server as your WHMCS database or otherwise has some kind of access to the WHMCS database.
If you're trying to display your WHMCS price list in a Joomla module, you'll first want to download and install a PHP module that allows for putting PHP code into modules. You can find a module at the Joomla Extensions site which also leads to this one that I used successfully at this site: http://www.fijiwebdesign.com/products/joomla-php-module.html.
Next, cut and paste the following code into the PHP module. You'll need to modify the database name and password accordingly:
<html>
<style>
table.mytable { width: 100%; padding: 0px; border: none; border: 1px solid #789DB3;}
table.mytable td { font-size: 12px; border: none; background-color: #F4F4F4;
vertical-align: middle; padding: 7px; font-weight: normal; }
table.mytable tr.special td { border-bottom: 1px solid #ff0000; }
</style>
<head>
<title>Domain Prices</title>
</head>
<body>
Registration price per year, maximum of 10 years
<?php
mysql_connect("localhost", "whmcs_database_name", "whmcs_database_password") or die(mysql_error());
mysql_select_db("whmcs_database_name") or die(mysql_error());
$result = mysql_query("SELECT * FROM tbldomainpricing where registrationperiod = 1 order by extension")
or die(mysql_error());
echo "<table width='300' border='0' class='mytable'>";
echo "<tr>
<th>TLD</th>
<th>Min. Years</th>
<th>Register</th>
<th>Transfer</th>
<th>Renew</th>
</tr>";
while($row = mysql_fetch_array($result)){
echo "<tr><td>";
echo $row['extension'];
echo "</td><td><center>";
echo $row['registrationperiod'];
echo "</center></td><td>";
echo "$";
echo $row['register'];
echo "</td><td>";
echo "$";
echo $row['transfer'];
echo "</td><td>";
echo "$";
echo $row['renew'];
echo "</td></tr>";
}
echo "</table>";
?>
</body>
</html>
Display the module on a page, create a menu link to the page and your prices should show up! Of course, you should make sure you've already created the price listing in WHMCS before doing this procedure.
If you want to show your hosting packages, insert the following code into a separate PHP module and your hosting packages will show!
<html>
<style>
table.mytable { width: 100%; padding: 0px; border: none; border: 1px solid #789DB3;}
table.mytable td { font-size: 12px; border: none; background-color: #F4F4F4;
vertical-align: middle; padding: 7px; font-weight: normal; }
table.mytable tr.special td { border-bottom: 1px solid #ff0000; }
</style>
<head>
<title>Prices</title>
</head>
<body>
<?php
mysql_connect("localhost", "whmcs_database_name", "whmcs_database_password") or die(mysql_error());
mysql_select_db("whmcs_database_name") or die(mysql_error());
$result = mysql_query("SELECT * FROM tblproducts")
or die(mysql_error());
echo "<table width='500' border='0' class='mytable'>";
echo "<tr>
<th>Name</th>
<th>Description</th>
<th>Monthly</th>
<th>Semi-Annual</th>
<th>Annual</th>
</tr>";
while($row = mysql_fetch_array($result)){
echo "<tr><td>";
echo $row['name'];
echo "</td><td><center>";
echo $row['description'];
echo "</center></td><td>";
echo "$";
echo $row['monthly'];
echo "</td><td>";
echo "$";
echo $row['semiannual'];
echo "</td><td>";
echo "$";
echo $row['annual'];
echo "</td></tr>";
}
echo "</table>";
?>
</body>
</html>
Now that you know how to do this, you can display just about anything from the WHMCS database inside Joomla!
If you're trying to display your WHMCS price list in a Joomla module, you'll first want to download and install a PHP module that allows for putting PHP code into modules. You can find a module at the Joomla Extensions site which also leads to this one that I used successfully at this site: http://www.fijiwebdesign.com/products/joomla-php-module.html.
Next, cut and paste the following code into the PHP module. You'll need to modify the database name and password accordingly:
<html>
<style>
table.mytable { width: 100%; padding: 0px; border: none; border: 1px solid #789DB3;}
table.mytable td { font-size: 12px; border: none; background-color: #F4F4F4;
vertical-align: middle; padding: 7px; font-weight: normal; }
table.mytable tr.special td { border-bottom: 1px solid #ff0000; }
</style>
<head>
<title>Domain Prices</title>
</head>
<body>
Registration price per year, maximum of 10 years
<?php
mysql_connect("localhost", "whmcs_database_name", "whmcs_database_password") or die(mysql_error());
mysql_select_db("whmcs_database_name") or die(mysql_error());
$result = mysql_query("SELECT * FROM tbldomainpricing where registrationperiod = 1 order by extension")
or die(mysql_error());
echo "<table width='300' border='0' class='mytable'>";
echo "<tr>
<th>TLD</th>
<th>Min. Years</th>
<th>Register</th>
<th>Transfer</th>
<th>Renew</th>
</tr>";
while($row = mysql_fetch_array($result)){
echo "<tr><td>";
echo $row['extension'];
echo "</td><td><center>";
echo $row['registrationperiod'];
echo "</center></td><td>";
echo "$";
echo $row['register'];
echo "</td><td>";
echo "$";
echo $row['transfer'];
echo "</td><td>";
echo "$";
echo $row['renew'];
echo "</td></tr>";
}
echo "</table>";
?>
</body>
</html>
Display the module on a page, create a menu link to the page and your prices should show up! Of course, you should make sure you've already created the price listing in WHMCS before doing this procedure.
If you want to show your hosting packages, insert the following code into a separate PHP module and your hosting packages will show!
<html>
<style>
table.mytable { width: 100%; padding: 0px; border: none; border: 1px solid #789DB3;}
table.mytable td { font-size: 12px; border: none; background-color: #F4F4F4;
vertical-align: middle; padding: 7px; font-weight: normal; }
table.mytable tr.special td { border-bottom: 1px solid #ff0000; }
</style>
<head>
<title>Prices</title>
</head>
<body>
<?php
mysql_connect("localhost", "whmcs_database_name", "whmcs_database_password") or die(mysql_error());
mysql_select_db("whmcs_database_name") or die(mysql_error());
$result = mysql_query("SELECT * FROM tblproducts")
or die(mysql_error());
echo "<table width='500' border='0' class='mytable'>";
echo "<tr>
<th>Name</th>
<th>Description</th>
<th>Monthly</th>
<th>Semi-Annual</th>
<th>Annual</th>
</tr>";
while($row = mysql_fetch_array($result)){
echo "<tr><td>";
echo $row['name'];
echo "</td><td><center>";
echo $row['description'];
echo "</center></td><td>";
echo "$";
echo $row['monthly'];
echo "</td><td>";
echo "$";
echo $row['semiannual'];
echo "</td><td>";
echo "$";
echo $row['annual'];
echo "</td></tr>";
}
echo "</table>";
?>
</body>
</html>
Now that you know how to do this, you can display just about anything from the WHMCS database inside Joomla!