Magento 如何使用模块配置文件中的 module_name 标签元素
我发现这里 Magento正在使用这些标签作为自定义配置变量,但我仍然不明白它们在哪里使用以及如何使用。 例如,Wishlist 模块在 config.xml 文件中具有 wishlist (与模块同名)xml 标记,其中定义:
<item>
<product_attributes>
<visibility/>
<url_path/>
<url_key/>
</product_attributes>
</item>
该模块在哪里使用这些配置? 另外,如果我要构建付款方式,我必须在自定义模块 config.xml 中添加 sales 标签,然后添加 quote 标签,依此类推... 我还发现了其他相关问题,但大多数答案是这些标签可以是任何东西,但我需要知道系统如何使用它们。 先感谢您
I found here that Magento is using these tags as custom config variables, but I still cannot understand where are they used and how.
For example the Wishlist module has wishlist (same name as the module) xml tag in the config.xml file in which it defines:
<item>
<product_attributes>
<visibility/>
<url_path/>
<url_key/>
</product_attributes>
</item>
Where is this module using these configurations?
Also if I was to build payment method, I have to add in my custom module config.xml a tag for sales and then for quote and so on...
I also found other related questions, but most of the answers were that these tags can be anything, but I need to know how they are used by the system.
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,直接负责的文件是
app/code/core/Mage/Wishlist/Model/Config.php
其中完全由以下内容组成:因此,每当您需要专门读取配置时,只需使用
Mage::getConfig()->getNode()
并传递您感兴趣的节点的路径。在此示例中,路径为您已经知道的global/wishlist/item/product_attributes
。每个模块都会根据需要读取其配置,并且没有正式的定义。这种灵活性允许任何模块对任何其他模块的设置做出贡献。
In this case the file directly responsible is
app/code/core/Mage/Wishlist/Model/Config.php
where consists entirely of this:So whenever you need to read the config specifically just use
Mage::getConfig()->getNode()
and pass the path of the node that interests you. In this example the path isglobal/wishlist/item/product_attributes
, which you already know.Each module will read it's configuration as it needs and there is no formal definition. This flexibility allows any module to contribute to any other module's settings.