How to get custom admin field value of specific Storeview in magento 2.3.2
-
15-04-2021 - |
سؤال
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...
المحلول
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);
}
}
لا تنتمي إلى magento.stackexchange