I'm new to Magento and PHP in general. I made a simple extension with a custom report based on the Products/Ordered report that shows a few extra fields and does some simple calculations based on certain product attributes.
I wanted to add a form field to filter the result in addition to the already present date range filter (In my case filter by the artist product attribute as a select)
I couldn't figure out how to add the field in the frontend nor how to properly access the value in the controller and pass it down to the Grid classes (I've seen an example reading the value from the
$_SESSION global(?) that doesn't look like the proper way to do this though)
EDIT: didn't really work on this anymore till now, I tried adding a custom form block to the report following this guide: http://codegento.com/2011/03/creating-custom-magento-reports/ (lower half... complex report)
All I got is an empty admin page though... and var_dump in the Controller returns
bool(false) for both blocks. So I guess they are not found?
Totally unsure if I got the layout file and declaration of these files right: The module name is Customreport the action for the report is called commissionAction, the Controller is defined in controllers/Report/CustomController.php and has the according name.
Here is the layout file declaration in etc/config.xml:
<adminhtml> <layout> <updates> <customreport> <file>customreport.xml</file> </customreport> </updates> </layout> </adminhtml>
and this is the content of the customreport.xml in app/design/adminhtml/default/default/layout:
<adminhtml_report_custom_commission> <update handle="report_customreport"> <reference name="content"> <block type="customreport/adminhtml_report_commission" template="report/grid/container.phtml" name="customreport.report.grid.container"> <block type="adminhtml/report_filter_form" name="grid.filter.form"> <action method="setFieldVisibility"> <field>report_type</field> <visibility>0</visibility> </action> </block> </block> </reference> </update> </adminhtml_report_custom_commission>
unsure about the first node...
adminhtml_report_controller_action is correct, no?
same for the
<update handle=-value from the example and the source I guess it's
report_modulename but can't really tell.
Any ideas where I went wrong? Is there an easier way to add another form field? Are all the changes in the example necessary (e.g. the changes to the collection... I actually don't want to touch this one since, it already does what I want)