0

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

app/code/core/Mage/Reports/etc/adminhtml.xml

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

<config>
    <menu>
        <report translate="title" module="reports">
            <children>
                <products translate="title" module="reports">
                    <children>      <!-- Menu Item -->
                        <viewed translate="title" module="reports">
                            <title>Most Viewed</title>
                            <action>adminhtml/report_product/viewed</action>
                        </viewed>
                    </children>
                </products>
            </children>
        </report>
    </menu>
</config>

Where it says:

<action>adminhtml/report_product/viewed</action>

I know that accesses

app/code/core/Mage/Adminhtml/Block/Report/Product

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?

1

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

1

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

http://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-3.html

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.