I have created a menu in the configuration menu.


I have an observer and I want to get the values of those two fields.

How can I do that?

Thanks for any help!


Try to use this below code in your observer :

protected $scopeConfig;

const XML_PATH_CREDIT_CARD = 'uv_email/general/uv_email_kredit';
const XML_PATH_SALES_TEAM = 'uv_email/general/uv_email_vertrieb';

public function __construct(
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
) {
    $this->scopeConfig = $scopeConfig;

public function execute(\Magento\Framework\Event\Observer $observer)
    $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
    $credit_card_value = $this->scopeConfig->getValue(self::XML_PATH_CREDIT_CARD, $storeScope);
    $sales_team_value = $this->scopeConfig->getValue(self::XML_PATH_SALES_TEAM, $storeScope);
  • Use this updated answer. – Emipro Technologies Pvt. Ltd. Jul 27 '18 at 9:46
  • Fatal error: Uncaught TypeError: Argument 1 passed to UO\CheckCartSpecialProducts\Observer\AfterPurchaseObserver::__construct() must implement interface Magento\Framework\App\Config\ScopeConfigInterface, none given, – k33n Jul 27 '18 at 10:09
  • Remove var/generation or generated/ folder after add this code. – Emipro Technologies Pvt. Ltd. Jul 27 '18 at 10:12
  • Go to core_config_data table in database. Then, search "uv_email/general/uv_email_kredit" in path column and check value is available or not. – Emipro Technologies Pvt. Ltd. Jul 27 '18 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.