cancel
Showing results for 
Search instead for 
Did you mean: 

Showing a value in a custom module config page

Showing a value in a custom module config page

Hello, i"ve been working on a custom module and i'm kind of stuck right now, basically when the module is installed it generates a token in the database and i would like to show the user that token in the config page.

vdssd.PNG

here is my system.xml part  that shows the field

			<fields>
        			<token_message>
            		<label>Token</label>
            		<frontend_type>text</frontend_type>
				<source_model>
				vendoflux/token
				</source_model>	
            		<sort_order>1</sort_order>
            		<show_in_default>1</show_in_default>
           		<show_in_website>1</show_in_website>
            		<show_in_store>1</show_in_store>                    
        			</token_message>
				
    			</fields>
                	
             

i tried to send random data with the toOptionarray() function in my /model/token.php file but doesnt seem to work, any help would be appreciatedpublic function toOptionArray()

  { 
    return array(
            array('value'=>1, 'label'=>Mage::helper('vendoflux')->__('Hello')),              
        );
  }
2 REPLIES 2

Re: Showing a value in a custom module config page

hi @mehdiG5

 

 If you generating the code on installer script you can set values for configuration

 

 

$installer->setConfigData('tabsection/group/token_message','//you token values');

or do it directly

Mage::getConfig()->saveConfig('tabsection/group/token_message', '//you token values', 'default', 0);

 

Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti

Re: Showing a value in a custom module config page

You should write value into database (core_config_data table), as said previous answer, or set value in default section of config
____________________________________________
Magento? it's really interesting.. BroSolutions like it Smiley Happy