2014-06-18 46 views
0

故事

我搜索了一个解决方案,但没有找到我能找到的解决方案,我是制作Magento模块的新手,作为一个开始,我试图创建title属性的一个非常简单的改变。简单的Magento模块:更新布局不起作用

问题

很简单:它不起作用(标题属性根本没有改变)。我刷新了所有缓存,并确认模块确实已在Config> Advanced> Advanced中加载。

代码:

/app/etc/modules/Acme_NewCoolModule.xml:

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

应用程序/代码/本地/阿克米/ 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> 

回答

0

Acme_NewCoolModule.xml代码包含错误的配置

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

你有</Firtal_EnhancedEcommerce>和它<Firtal_NewCoolModule>,这是错误的。

我假设你namespaceAcme和模块名称是NewCoolModule

+0

对不起 - 我只是忘了将它从原来的改成它,它实际上是写在你写在这里的。现在在OP中改变了它。 – Dencker

+0

@Dencker:编辑之后,你的Acme_NewCoolModule也是错误的。检查关闭节点'' –

+0

感谢您的通知:) – Dencker

0

你在/app/etc/modules/Acme_NewCoolModule.xml代码应该

/app/etc/modules/Acme_Newcoolmodule.xml

CODE:

1)替代

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

应该是:的

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

2)代替app/code/local/Acme/NewCoolModule/etc/config.xml

应该是

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> 
       <newcoolmodule> 
        <file>newcoolmodule.xml</file> 
       </newcoolmodule> 
      </updates> 
     </layout> 
    </frontend> 
</config> 

,其中Acme的- 命名空间Newcoolmodule - 模块名称上的Magento驼峰使用

简介:

您的config.xml文件中保存您的前缀一个配置节点称为global/models/yourpackage为您的班级模型。

当您拨打Mage::getModel('packagename/classname')时,Magento会取回此配置节点。 Company_Yourmodule_Models增加了_,然后用首字母大写的类名:

Company_Yourmodule_Models_Classname

如果你有cAMElcaSe类名,这也是同样的道理。所以,假设你的班级的名字是ClassName,那么你必须致电Mage::getModel('packagename/className'),并且magento将其解析为:Company_Yourmodule_Models_ClassName

+0

嗯,是骆驼案件的问题? – Dencker

+0

@Dencker看到我编辑的答案。粘贴上面的配置代码,并检查 – Slimshadddyyy

+0

现在尝试一切,假设Acme_Newcoolmodule也在第一个代码块中。仍然不起作用。我正在制作一台生产服务器(是的,我知道,我是一个坏男孩),所以也许其他一些模块会覆盖标题。在Magento Markup中重要的CSS可以做到吗? – Dencker