I'm working on creating a custom report and rather than just cut and paste code I'm trying to understand how magento layout files work better.

Magento 1.9 I'm looking at a report Products -> Most Viewed.

I've found the menu item added in


Obviously I removed a lot to just show what I'm asking questions about.

        <report translate="title" module="reports">
                <products translate="title" module="reports">
                    <children>      <!-- Menu Item -->
                        <viewed translate="title" module="reports">
                            <title>Most Viewed</title>

Where it says:


I know that accesses


My question is, does the /viewed mean it opens Viewed.php, or subfolder /Viewed?

If the answer is it opens Viewed.php, what then opens the file /Viewed/Grid.php?


It calls the Viewed.php file.

That file extends the app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php file's class.

In that file, you will find the protected function _prepareLayout() which uses the setChild method to assign the appropriate file as Mage/Adminhtml/Block/***/Grid.php


Found this tutorial that helped me understand the magento file structure.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.