Magento Enterprise – Create Layout File for Module in Different Package

layoutmagento-enterprisetemplatetheme

I've been reading a few tutorials, and also a book where they explain how to override, create and manipulate themes, so far so good, however all of them just address how to create layouts for custom modules with a different name, here is my situation:

I created a module name "Customer" under a package named "MyCompany" so the path for the code would be :

\app\code\local\MyPackage\Customer

I found a few collision issues that I was able to address with the help of the config.xml file for the module, however I've been unable to determine where should I place my layout and folder for the given theme as

app\design\frontend\MyPackage\default\layout\customer.xml

Is already used by the module that comes with magento, I have not intention of manipulate the core files, I was wondering if there is away to have a different name for the layouts, templates etc or if the only work around would be a name change for my module.

Best Answer

In your module config.xml, you can define the layout file that must be used.

<!-- we are making changes to the frontend -->
    <frontend>

        <!-- we are making changes to the layout -->
        <layout>

            <!-- we are adding a new update file -->
            <updates>

                <!-- 
                    this child node name must be
                    unique throughout Magento
                -->
                <smashingmagazine_layout 
                         module="SmashingMagazine_Layout">

                    <!-- the name of the layout file we are adding -->
                    <file>smashingmagazine_layout.xml</file>

                </smashingmagazine_layout>

            </updates>

        </layout>

    </frontend>

ref: http://coding.smashingmagazine.com/2012/11/30/introducing-magento-layout/

Related Topic