Jump to content

Missing css in my new admin controller


Recommended Posts

Hi everyone,

 

I created a new admin controller in prestashop, I used helperlist but view of my admin page is distorted.

-----------------------------------------------------------------------------------------------------------

I've followed these steps :

 

1. - I created /controllers/admin/AdminResellersreqController.php like so:
class AdminResellersControllerCore extends AdminController{}

2. I created /classes/Resellersreq.php like
class ResellersreqCore extends ObjectModel{}

 

3. I created ps_resellers_req table 

--------------------------------------------------------------------------------------------------

this is my admincontroller code :

 

class AdminResellersreqControllerCore extends AdminController
{
   
    public function initProcess()
    {
        $this->id_object = Tools::getValue('id_'.$this->table);
 
        if (Tools::isSubmit('changeStatus') && $this->id_object)
            $this->action = 'change_status';
 
        parent::initProcess();
    }
 
    public function __construct()
    {
        $this->table = 'resellers_req';
        $this->className = 'Resellersreq';
 
        $this->lang = false;
 
     
        $this->fields_list = array(
        
            'req_date' => array(
                'type' => 'date',
                'title' => $this->l('Request Date'),
                'width' => 'auto'
            ),
            'description' => array(
                'title' => $this->l('Description'),
                'width' => 'auto'
            ),
            'status' => array(
                'title' => $this->l('Status'),
                'type' => 'bool',
                'width' => 'auto'
            ),
 
         'id_customer' => array(
                'title' => $this->l('Edit Group'),
               // 'type' => 'text',
                'callback' =>'ShowCustomerGroupLink',
                'width' => 'auto'
            ),
        );
 
 
        parent::__construct();
 
 
    }
 
    // This method generates the list of results
    public function renderList()
    {
        $this->simple_header = true;
        return parent::renderList();
    }
 

}
------------------------------------------------------------------------------------------------------

 

 

But the view of my admin page haven't any css!!

could anyone help me? 

 

 

 view of may admin page controller :

 post-815190-0-33025700-1409549489_thumb.jpg

controllerpage.bmp

Link to comment
Share on other sites

Hi everyone,

 

I created a new admin controller in prestashop, I used helperlist but view of my admin page is distorted.

-----------------------------------------------------------------------------------------------------------

I've followed these steps :

 

1. - I created /controllers/admin/AdminResellersreqController.php like so:

class AdminResellersControllerCore extends AdminController{}

 

2. I created /classes/Resellersreq.php like

class ResellersreqCore extends ObjectModel{}

 

3. I created ps_resellers_req table 

--------------------------------------------------------------------------------------------------

this is my admincontroller code :

 

class AdminResellersreqControllerCore extends AdminController
{
   
    public function initProcess()
    {
        $this->id_object = Tools::getValue('id_'.$this->table);
 
        if (Tools::isSubmit('changeStatus') && $this->id_object)
            $this->action = 'change_status';
 
        parent::initProcess();
    }
 
    public function __construct()
    {
        $this->table = 'resellers_req';
        $this->className = 'Resellersreq';
 
        $this->lang = false;
 
     
        $this->fields_list = array(
        
            'req_date' => array(
                'type' => 'date',
                'title' => $this->l('Request Date'),
                'width' => 'auto'
            ),
            'description' => array(
                'title' => $this->l('Description'),
                'width' => 'auto'
            ),
            'status' => array(
                'title' => $this->l('Status'),
                'type' => 'bool',
                'width' => 'auto'
            ),
 
         'id_customer' => array(
                'title' => $this->l('Edit Group'),
               // 'type' => 'text',
                'callback' =>'ShowCustomerGroupLink',
                'width' => 'auto'
            ),
        );
 
 
        parent::__construct();
 
 
    }
 
    // This method generates the list of results
    public function renderList()
    {
        $this->simple_header = true;
        return parent::renderList();
    }
 

}

------------------------------------------------------------------------------------------------------

 

 

But the view of my admin page haven't any css!!

could anyone help me? 

 

 

 view of may admin page controller :

 attachicon.gifcontrollerpage.JPG

 

 

 

I found out that in html code of my admin controller page the class of div with content id is nobootstrap 

<div id="content" class="nobootstrap" > 

 

but in another admin controllers like adminproduct controller the class of div with content id is bootstrap

<div id="content" class="nobootstrap" > 

 

where can  change this class? in which file or how?

 

could anyone help me please?

Edited by elham_K (see edit history)
Link to comment
Share on other sites

in your __construct function use

$this->bootstrap = true;

and add this:

    public function hookActionAdminControllerSetMedia($params)
    {
		if ($this->context->controller->controller_name == 'YourAdminController' 
			$this->context->controller->addCSS(($this->_path) . 'css/your_admin.css');			
		}

    }
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Hello,

 

I actually have the same problem.

 

In my moduleAdminController I set $this->bootstrap = true;

I also resgistered new hook to my module - hookActionAdminControllerSetMedia  - and the adequate function to add JS & CSS resources. I uninstalled and reinstalled and both files are loaded.

 

But template loaded is still noboostrap...?

 

Has someone an idea please ?

 

I of course managed to do it through JS by changing class of div #content but it doesn't appear to me as a 'clean' solution...

 

Alexandre

Edited by Creativus Comunico (see edit history)
Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...