Domanda

I want to add a custom text area for contact info for a particular store view from configuration and get that custom field value and display it on the contact us page in Magento 2.3.2.

so can anyone have an idea then please share it with me.

Thanks in Advance...

È stato utile?

Soluzione

Try This code

<?php

namespace Vendorename\Modulename\Helper;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;


class Data extends AbstractHelper
{
    const XML_PATH_ENABLE = 'sectionname/groupname/fieldname';

    protected $_scopeConfig;


    public function __construct(
        ....................................
        ScopeConfigInterface $scopeConfig,
        ....................................
    ) {
        ....................................
        $this->_scopeConfig = $scopeConfig;
        ....................................
    }

    public function isEnabled()
    {
        return $this->_scopeConfig->getValue(self::XML_PATH_ENABLE, ScopeInterface::SCOPE_STORE);
    }

}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top