gpt4 book ai didi

magento - 在 Observer 中获取 magento 模块配置数据

转载 作者:行者123 更新时间:2023-12-04 01:18:58 24 4
gpt4 key购买 nike

我用事件钩子(Hook)‘sales_order_shipment_save_after’为销售模块创建了一个带有观察者的模块,

我的模块有以下文件

  • 公司/模块名/etc/config.xml
  • 公司/模块名/etc/system.xml
  • 公司/模块名称/型号/Observer.php

  • 模块管理配置字段中有四个字段
    我想在 Observer 类中获取那些保存的数据。

    使用 $this->getConfigData('password'); 给出一个

    Call to undefined method



    错误
    有什么建议么?

    最佳答案

    Magento 在全局 Mage 上使用静态方法获取配置值的应用程序对象

    $config = Mage::getStoreConfig('section_name/group/field'); //value
    $config = Mage::getStoreConfig('section_name/group'); //array

    关于magento - 在 Observer 中获取 magento 模块配置数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3211393/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com