rdiz
rdiz

Reputation: 6176

Simple Magento Module: Update layout not working

The story

I searched for a solution for this, but none of what I can find seems to fix the problem; I'm new to making Magento Modules, and as a start I'm trying to create a very simple change of the title attribute.

The problem

Is simple: It doesn't work (The Title attribute simply isn't changed). I refreshed all caches and verified that the module is indeed loaded in Config > Advanced > Advanced.

Code:

/app/etc/modules/Acme_NewCoolModule.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Acme_NewCoolModule>
            <active>true</active>
            <codePool>local</codePool>
        </Acme_NewCoolModule>
    </modules>
</config>

app/code/local/Acme/NewCoolModule/etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Acme_NewCoolModule>
            <version>1.0.0.0</version>
        </Acme_NewCoolModule>
    </modules>
    <frontend>
        <layout>
            <updates>
                <Acme_NewCoolModule>
                    <file>acme_newcoolmodule.xml</file>
                </Acme_NewCoolModule>
            </updates>
        </layout>
    </frontend>
</config>

app/design/base/default/layout/acme_newcoolmodule.xml:

<?xml version="1.0"?>
<layout>
    <default>
        <reference name="head">
            <action method="setTitle"><string>Hello World</string></action>
        </reference>
    </default>
</layout>

Upvotes: 0

Views: 114

Answers (2)

Slimshadddyyy
Slimshadddyyy

Reputation: 4073

Your code at /app/etc/modules/Acme_NewCoolModule.xml should be

/app/etc/modules/Acme_Newcoolmodule.xml

CODE:

1) Instead of

<?xml version="1.0"?>
<config>
    <modules>
        <Firtal_NewCoolModule>
            <active>true</active>
            <codePool>local</codePool>
        </Firtal_EnhancedEcommerce>
    </modules>
</config>

Should be:

<?xml version="1.0"?>
<config>
    <modules>
        <Firtal_Newcoolmodule>
            <active>true</active>
            <codePool>local</codePool>
        </Firtal_Newcoolmodule>
    </modules>
</config>

2) instead of app/code/local/Acme/NewCoolModule/etc/config.xml

Should be

app/code/local/Acme/Newcoolmodule/etc/config.xml

and the config code should be

<?xml version="1.0"?>
<config>
    <modules>
        <Acme_Newcoolmodule>
            <version>1.0.0.0</version>
        </Acme_Newcoolmodule>
    </modules>
    <frontend>
        <layout>
            <updates>
                <newcoolmodule>
                    <file>newcoolmodule.xml</file>
                </newcoolmodule>
            </updates>
        </layout>
    </frontend>
</config>

where Acme - Namespace and Newcoolmodule - Module Name

Brief on Magento Camel Case Usage:

You have a config-node in your config.xml called global/models/yourpackage in which you save your Prefix for your class models.

When you call Mage::getModel('packagename/classname') Magento fetches this config node e.g. Company_Yourmodule_Models adds a _ and then the classname with uppercase first letter:

Company_Yourmodule_Models_Classname

if you have cAMElcaSe classnames, it is the same way. So let's say your class' name is ClassName then you have to call Mage::getModel('packagename/className') and magento resolves it to: Company_Yourmodule_Models_ClassName

Upvotes: 0

Rajeev K Tomy
Rajeev K Tomy

Reputation: 2214

your Acme_NewCoolModule.xml codes contain wrong configuration

<config>
    <modules>
        <Acme_NewCoolModule>
            <active>true</active>
            <codePool>local</codePool>
        </Acme_NewCoolModule>
    </modules>
</config>

You had </Firtal_EnhancedEcommerce> and <Firtal_NewCoolModule> in it and it is wrong.

I assume your namespace is Acme and Module name is NewCoolModule

Upvotes: 0

Related Questions