Skip to content

Instantly share code, notes, and snippets.

@wsakaren
Created September 2, 2015 05:41
Show Gist options
  • Save wsakaren/3a26a61347cbe485677f to your computer and use it in GitHub Desktop.
Save wsakaren/3a26a61347cbe485677f to your computer and use it in GitHub Desktop.
Mage::getStoreConfig in Magento 2 compared to Magento 1
Magento 1.x:
Mage::getStoreConfig('carriers/shipper/active')
Magento 2.x:
protected $scopeConfig;
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
) {
$this->scopeConfig = $scopeConfig;
}
Then can do -
$this->_scopeConfig->getValue(
'carriers/shipper/active',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE);
@timneutkens
Copy link

timneutkens commented Sep 19, 2016

I forked your gist and added markdown markup, makes the whole a little more readable 😉
https://gist.github.com/timneutkens/17185b139e8476ec7296c92142d03028

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment