Create table to see data in frontend

This area is devoted to Magento Form Builder SmartFormer Gold. Please ask questions, report bugs and share ideas here.

Create table to see data in frontend

Postby sylog » Tue Nov 15, 2011 2:04 pm

Hello,
Great extension. However, i would like to know if it's possible to see and manage data directly in frontend ?? and by different customer...
Best regards.
Dan
sylog
 
Posts: 1
Joined: Tue Nov 15, 2011 1:59 pm

Re: Create table to see data in frontend

Postby IToris team » Thu Jan 12, 2012 3:33 pm

Hello Dan,

If you wish to see data from any DB table on front end please do the following:

1. create a new form
2. open Tools - PHP Editor and add to the end the following code:

Code: Select all
$dbName = "sfg_example_contact"; // set source DB table

$db = Mage::getSingleton('core/resource')->getConnection('core_write');
$columns = $db->query("show columns from $dbName")->fetchAll();

$data = $db->query("select * from $dbName order by name")->fetchAll();

echo '<table border="1"><tr>';
foreach ($columns as $column) echo '<td align="center"><b>'.$column['Field'].'</b></td>';
echo '</tr>';
foreach ($data as $value) {
     echo '<tr>';
     foreach ($columns as $column)  echo '<td align="left">'.htmlspecialchars($value[$column['Field']]).'</td>';
     echo '</tr>';
}
echo '</table>';


Please change a name of DB table on this line (sfg_example_contact)

Code: Select all
$dbName = "sfg_example_contact"; // set source DB table


and a name of column on this line (name)
Code: Select all
$data = $db->query("select * from $dbName order by name")->fetchAll();


Management of data on the front end is a complex request. We can not provide a solution within free support unfortunately. We can provide you the customization if you wish. Please contact sales@itoris.com for more details.

IToris Team
IToris team
Site Admin
 
Posts: 1355
Joined: Mon Jan 19, 2009 12:33 pm


Return to SmartFormer Gold for Magento

Who is online

Users browsing this forum: No registered users and 1 guest