Hi guys,
I have huge distributors address book script in that reads from my custom database (one table) and displays information
based on country i select.
Is there a way a add-on perhaps, that i can use to integrate this address book into the cs-cart 2 page view?.
So that i could select country from the menu and pass it to php to display the information?
Thing is i could use the store locator add-on ,but if the store locator could read table values from my database,
which is huge.
now I render the values in the html and paste 'em into the content page, but if i could do this dynamically it would be great.
For example my caller script is something like this:
trigger.html
**********************************************************************
$locaton = "display.php";
echo
'
Austria
Canada
Czech Republic
England
Germany
Ireland
Italy
Japan
Poland
Russia
Scotland
Slovenia
Spain
Sweden
Switzerland
The Netherlands
'
?>
************************************************************************
and my viewer is:
display.php
*************************************************************************
class Address_Book_Please
{
function __construct()
{
$username ="***";
$password ="***";
$database ="****";
$country = $_POST['country'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM `my_one_table` WHERE Country ='$country'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$Name=mysql_result($result,$i,"Name");
$Street=mysql_result($result,$i,"Street");
$City=mysql_result($result,$i,"City");
$Country=mysql_result($result,$i,"Country");
$Phone=mysql_result($result,$i,"Phone");
$Fax=mysql_result($result,$i,"Fax");
$email=mysql_result($result,$i,"email");
$website=mysql_result($result,$i,"website");
echo "
- ".$Name."
- ".$Street."
- ".$City."
- ".$Country."
- ".$Phone."
- ".$Fax."
- ".$email."
- ".$website."
$i++;
}
}
}
$app = new Address_Book_Please();
?>
***********************************************************************************************************************
Is this possible, and how difficult it would be to write the add on for it?
or if anybody can direct me to any tutorial on writing add-ons.
Kind regards