0

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.enter image description here

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 appreciated

public function toOptionArray(){ 
return array(
        array('value'=>1, 'label'=>Mage::helper('vendoflux')->__('Hello')),              
    );

}

1
  • Did you get your issue resolved? Commented Apr 10, 2017 at 8:50

1 Answer 1

0

You cannot use source_model for a text field, You need to use select or multiselect field.

Try below code,

<fields>
    <token_message>
        <label>Token</label>
        <frontend_type>select</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>

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.