2

I need to get the complete row from core_config_data table, to then make a few conditions. I know you can get a table by table-name, like:

->getTableName('table_name');

But i need to know if there's a way to call directly core_config_data table.

Thank you

1 Answer 1

4

You can call the core_config_data table's resource model:

Mage::getModel('core/config_data')->load($id)

You can even get the model from the collection, like any other collection in Magento:

Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('config_id',$id);

Or just get the first item in the collection:

Mage::getModel('core/config_data')->getCollection()->getFirstItem();
3
  • Thanks. I assume the id parameter in ->load($id) is the scope_id value in core_config_data table, right?. If so, how can i get the scope_id value?
    – Guille
    Commented Feb 26, 2014 at 20:40
  • It is the config_id in the table, yes.
    – philwinkle
    Commented Feb 26, 2014 at 21:14
  • You can also use any other field name in addFieldToFilter, too.
    – philwinkle
    Commented Feb 26, 2014 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.