I have asked this on Stack Overflow but had no response at all. Hoping to gain some attention on here.
I know there are similar questions out there for this but none of them provide a working answer.
I am creating a form using $fieldset->addfield();
. My code is the following:
$fieldset->addField('monday_open', 'select', array(
'label' => "Monday",
'required' => false,
'name' => 'store_title',
'values' => array(
'00' => '00',
'01' => '01',
'02' => '02',
'03' => '03',
'04' => '04',
'05' => '05'
),
'container_id' => 'some_row'
));
$fieldset->addField('monday_close', 'select', array(
'required' => false,
'name' => 'store_title',
'values' => array(
'00' => '00',
'01' => '01',
'02' => '02',
'03' => '03',
'04' => '04',
'05' => '05'
),
'container_id' => 'some_row'
));
This, as you will know, prints 2 table columns per row, one label and one field. I am wanting multiple (3, 4, 5, etc) fields per row.
I am only new to Magento so it is very possible I am missing something.
Is there a way to customise the table that is used in these forms? I dont have a template linked in my layout xml. This file is as follows:
<layout version="0.1.0">
<stores_adminhtml_index_index>
<reference name="content">
<block type="stores/adminhtml_grid" name="stores" />
</reference>
</stores_adminhtml_index_index>
And here is the contents of Block/Adminhtml/Grid.php:
class Pivotal_Stores_Block_Adminhtml_Grid extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct() {
$this->_controller = 'adminhtml_stores'; // Adminhtml/Stores
$this->_blockGroup = 'stores';
$this->getHeaderText = "Our Stores Management";
$this->addButtonLabel = "Add a Store";
parent::__construct();
}
}
Really hoping there is a ~simple~ way to do this in php but, if not, can someone please let me know how I can create a custom layout/template for this?
Best Answer
How I added custom template & controller in admin edit form
In your adminhtml tab block Block/Adminhtml/MyExtension/Edit/Tab/MyExtension.php(See on GitHub)
then my path/to/my/phtml/file/template.phtml (see on GitHub) - Its up to you to style to meet your grouped row requirments
and your controller action at /controllers/Adminhtml/MyExtensionController.php(See on GitHub)
Hopefully theres enough info here to get you going but you will need to style your tabs layout to position your fields into one row, just copy the html layout from the native admin tab layout
good luck!