Developer's Guide

protected $fieldsValidate = array( 'test' => 'isGenericName' );
protected $table = 'test';
protected $identifier = 'id_test';
public function getFields()
{
parent::validateFields();
$fields[ 'test' ] = pSQL( $this->test );
return $fields;
}
}
?>
1. Create a blank file named AdminTest.php in PrestaShop's /admin/tabs.
2. Add the following lines to that file:
AdminTest.php
<?php
include_once( PS_ADMIN_DIR . '/../classes/AdminTab.php' );
class AdminTest extends AdminTab
{
public function __construct()
{
$this->table = 'test';
$this->className = 'Test';
$this->lang = false;
$this->edit = true;
$this->delete = true;
$this->fieldsDisplay = array(
'id_test' => array(
'title' => $this->l( 'ID' ),
'align' => 'center',
'width' => 25 ),
'test' => array(
'title' => $this->l( 'Name' ),
'width' => 200 )
);
$this->identifier = 'id_test';
parent::__construct();
}
public function displayForm()
{
global $currentIndex;
$defaultLanguage = intval( Configuration::get( 'PS_LANG_DEFAULT' ) );
$languages = Language::getLanguages();
$obj = $this->loadObject( true );
echo '
<script type="text/javascript">
id_language = Number('.$defaultLanguage.');
</script>';
echo '