Magento 시스템 설정 가져오기 How to get data from Magento System Configuration

1687 단어
I just wandering on how I can get the configuration data for my custom module. The configuration can be set from the admin system->configuration and how to pull it in frontend?
 
 
해결 방법:
$configValue = Mage::getStoreConfig('sectionName/groupName/fieldName');

 
 
sectionName, groupName and fieldName are present in etc/system.xml file of your module.
 
The above code will automatically fetch config value of currently viewed store.
 
 
If you want to fetch config value of any other store than the currently viewed store then you can specify store ID as the second parameter to the getStoreConfig function as below:
$storeId = 2; // ID of the store you want to fetch the value of
$configValue = Mage::getStoreConfig('sectionName/groupName/fieldName', $storeId);

 
 
혹은
$configValue = Mage::getStoreConfig('sectionName/groupName/fieldName',Mage::app()->getStore());

  
 
 
텍스트:http://stackoverflow.com/a/5893586
 
 
 
예: system->configuration -> Catalog-> Frontend->Products per Page on Grid Default Value 
 
$grid_per_page = Mage::getStoreConfig('catalog/frontend/grid_per_page'); 
$grid_per_page_values = explode(',', Mage::getStoreConfig('catalog/frontend/grid_per_page_values'));

 
다음으로 이동: 시스템 설정 가져오기 How to get data from Magento System Configuration
 
 
 
 
 
 

좋은 웹페이지 즐겨찾기