2

Using Magento 1.9.3 Mage::getStoreConfig is redirecting magento admin to 404 page instead of retrieving the store field value.


In controller

$store = $this->getRequest()->getParam('website');

if (!$store) { 
    $storeID = 1; //use default store if none was given 
} else {
    $storeID = Mage::app()->getWebsite($store)->getId();
}

Mage::helper('setstartordernumber')->getOrderNumber($storeID)

In helper

class Aschroder_SetStartOrderNumber_Helper_Data extends Mage_Core_Helper_Abstract {

    public function getOrderNumber($iStoreId=null) {
        return Mage::getStoreConfig('sales/setstartordernumber/order',$iStoreId);
    }
}

What could the code be missing? Any idea?

Update:

This issue arise only when calling Mage::getStoreConfig from Helper.

1

Since Mage::getStoreConfig causing magento return 404 with no error logs or exceptions I decided to create a custom function to get store configuration base on path and scope Id (store id in my case).

class Aschroder_SetStartOrderNumber_Helper_Data extends Mage_Core_Helper_Abstract {

    // some code

    public function getStoreConfig($path, $scopeId) {
        $configs = Mage::getModel('core/config_data')->getCollection();
        $configs->getSelect()->where('path=?', $path);
        $configs->getSelect()->where('scope_id=?', $scopeId);
        foreach ($configs as $val) {
            return $val->getValue();
        }
    }
}
0

Use the Below Code

$store = Mage::app()->getStore(); // store info
$configValue = Mage::getStoreConfig('sectionName/groupName/fieldName', $store);
5
  • I need current store config field value – Aboodred1 Aug 17 '18 at 22:36
  • i HAVE updated please check – Learing_Coder Aug 17 '18 at 22:39
  • None of them will work for me. I'm trying to get field info from system -> configuration -> sales – Aboodred1 Aug 17 '18 at 22:42
  • i Have Updated my code please check once. – Learing_Coder Aug 17 '18 at 23:18
  • This won't either, because I want to pass specific website name in the url – Aboodred1 Aug 17 '18 at 23:37

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.