Wednesday, October 17, 2012

How to get default configuration store scope setting value in mgento

Hi Guys,

One day i need to pull the country collection of selected in the Allow country list in under general tab for default configuration store scope but not getting any clue for this. After 4-5 hours review the code and database table finally  i success to do this. I don't know this is right way or not but it works . it may helpsome who want to such a things.......

////////////////////////////////////

             $rr= Mage::getConfig()->getNode('general/country/allow','default');
$rr=explode(',',$rr);
$options =Mage::getModel('directory/country')->getCollection()
->addFieldToFilter('country_id',array('in'=>$rr))
->load()
->toOptionArray();


///////////////////////////////////////
 This line       $rr= Mage::getConfig()->getNode('general/country/allow','default');  help to choose the country id string for default scope value. And then we can get the selected country's  list.


enjoy!!!!!

9 comments:

  1. Really this is helpful, amazing post sir, thanks a lot.

    ReplyDelete
  2. Hurrey, I was looking for the same nice work

    ReplyDelete
  3. HI vinod do you have experience in flying cart in magento

    ReplyDelete
    Replies
    1. HI Pankaj,

      Yes I am doing work on cart extension for magento, having this feature. I will reply soon with the download link.
      Thanks
      Vinod

      Delete
    2. awesome , I was looking for that

      Delete
    3. Thanks,

      I will be back with in one or two day after with good news.

      Vinod

      Delete