Thứ Ba, 2 tháng 8, 2011

How to retrieve data in the database - Prestashop

Hi!
I will show you how to retrieve data in the database in back office - Prestashop.
1. The first, create table :


CREATE TABLE IF NOT EXISTS '._DB_PREFIX_.'table01(
  id_table01 int(11) NOT NULL AUTO_INCREMENT,
  name varchar(200) NULL,
  PRIMARY KEY (id_table01)
)';

2. add write following code your file admintab.

$this->fieldsDisplay(
    'id_table01' => array('title' => $this->l('ID'), 'align'=>'center', 'width'=>25),
   'name' => array('title' => $this->('ID'), 'width'=>400)
);

3. example

<?php
require_once dirname(__FILE__).'/../../classes/AdminTab.php';
class Adminexample extends AdminTab
{
    function __construct()
   {

        $this->fieldsDisplay(
           'id_table01' => array('title' => $this->l('ID'), 'align'=>'center', 'width'=>25),
           'name' => array('title' => $this->('ID'), 'width'=>400)
        );       
       parent::__construct();
   }
}


Thank you for time. Please feel free to ask any question and feedback.

Không có nhận xét nào:

Đăng nhận xét