Jump to content

BO edit module record fields not populated


banditbirds

Recommended Posts

Hi people,

 

Hope someone can help me.

 

I am trying to add my module to the BO. I have a a tab on the menu, and a list of items in my module's database. But when I select one of these items to edit, it loads the form, with the fields I have. But the values from the item are not populated.

 

I'm using the Customer>Contacts admincontroller as an example.

 

I've attached images of my list and the edit record form when I select one.

 

Here is my AdminBlockQuoteController.php

class AdminBlockQuoteController extends ModuleAdminController

{

public function __construct()

{
   $this->bootstrap = true;
   $this->table = 'custom_order';
   $this->className = 'BlockQuote';
   $this->lang = false;
   $this->addRowAction('edit');
   $this->context = Context::getContext();
   $this->bulk_actions = array(
       'delete' => array(
       'text' => $this->l('Delete selected'),
       'confirm' => $this->l('Delete selected items?'),
       'icon' => 'icon-trash'
         )
   );
   $this->_select = 'CONCAT(LEFT(cu.`firstname`, 1), \'. \', cu.`lastname`) AS `customer` ';


   $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` cu ON (cu.`id_customer` = `user_id`)';


   $this->fields_list = array(


      'id_custom_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
      'request_details' => array('title' => $this->l('Request Details'), 'width' => 230),
      'date_needed' => array('title' => $this->l('Date Needed By'), 'align' => 'center', 'width' => 30),
      'request_price' => array('title' => $this->l('Request Price'), 'align' => 'center', 'width' => 20),
      'customer' => array('title' => $this->l('Customer'), 'align' => 'center', 'width' => 40),
   
    );

  
  parent::__construct();

}


public function renderForm()
{
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Quote'),
'icon' => 'icon-envelope-alt'
),
'input' => array(
array(
'type' => 'textarea',
'label' => $this->l('Request Details'),
'name' => 'request_details',
'required' => true,
'lang' => false,
'col' => 4,
'hint' => $this->l('Details of the custom request'),
),
array(
'type' => 'date',
'label' => $this->l('Date Requested'),
'name' => 'date_needed',
'required' => false,
'col' => 4,
'hint' => $this->l('Date requested by customer'),
),


array(
'type' => 'text',
'label' => $this->l('Price Requested'),
'name' => 'request_price',
'required' => false,
'lang' => false,
'col' => 6,
'hint' => $this->l('Price requested by customer'),
),
),
'submit' => array(
'title' => $this->l('Save'),
)
);


return parent::renderForm();
}


}

 

post-770181-0-31866900-1400841772_thumb.png

post-770181-0-08139200-1400841839_thumb.png

Link to comment
Share on other sites

I think this is to do with the difference in using AdminController and ModuleAdminController.

 

If I extend AdminController which is used in the code I've taken this from (as the controller is a ControllerCore and in classes) then I can load my list of database items, but not edit one of them.

 

If I extend ModuleAdminController, then I can edit one of them, but it doesn't load the details for the record.

 

So I'm guessing, I'm missing something in my AdminBlockQuoteController.php that is used by ModuleAdminController to load this info....but I haven't a clue what I'm missing :(

 

 

Does anyone have any ideas????

Link to comment
Share on other sites

  • 4 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...