samedi 25 avril 2015

Magento Dependency Custom Form


I am new to magento and am working in making some updates to a module. As far as I've seen all form configuration for admin is done through system.xml, I need to add some sort of dependency as I want my form to check for some api credentials if they are correct show some other inputs. I've tried with depends tag but am not being able to call a function from there.

So I have two questions: How do I manage to make dependency when it depends on a value I do not know unless i consult for example an api, can I do something like:

<usertoken translate="label">
    <label>User Token</label>
    <frontend_type>text</frontend_type>
    <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>
</usertoken>
<new_value translate="label">
    <label>New Value</label>
    <frontend_type>text</frontend_type>
    <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>
    <depends><usertoken><action>mymodule/system_config_source_token/retorno</action></usertoken></depends>
</new_value>

If so, what should I use instead of action.

My seccond question is, is there any other way to construct a form in admin panel than using system.xml, I would like to create my own custom forms, using ajax, tables with checkboxes.... but would like to understand how can I integrate that.


Aucun commentaire:

Enregistrer un commentaire