4

how simple would it be to do as in magento1

 Mage::getStoreConfig('general/store_information/name')
9
$this->_scopeConfig->getValue('general/store_information/name');

And the equivalent for

Mage::getStoreConfigFlag('path/goes/here')

is

$this->_scopeConfig->isSetFlag('path/goes/here'); 

but you have to make sure that the _scopeConfig member exists. if it doesn't inject it in the constructor. Like this:

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

As a side node...I think the answers to all 3 questions you asked regarding magento2, should give you an idea on how to inject something you need in the controller and use it later.

| improve this answer | |
  • i get a clearer idea indeed , very useful and clear replies as usual , thanks !!! – Matoeil Aug 20 '14 at 15:08

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.