【发布时间】:2015-04-26 10:50:15
【问题描述】:
我是 magento 的新手,正在对模块进行一些更新。 据我所知,admin 的所有表单配置都是通过 system.xml 完成的,我需要添加某种依赖项,因为我希望我的表单检查某些 api 凭据是否正确显示其他输入。 我尝试过使用依赖标签,但无法从那里调用函数。
所以我有两个问题: 当它依赖于我不知道的值时,我如何设法建立依赖关系,除非我咨询例如 api,我可以做类似的事情:
<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>
如果是这样,我应该用什么来代替行动。
我的第二个问题是,除了使用 system.xml 之外,还有其他方法可以在管理面板中构建表单吗?我想创建自己的自定义表单,使用 ajax,带有复选框的表格......但想了解如何整合它。
【问题讨论】:
-
Stackoverflow 最适合一次问一个问题。由于您的问题是针对 Magento 的,我建议您考虑在 Magento Stackexchange 上发帖:magento.stackexchange.com - 以及哪些 XML 元素可用以及它们是如何工作的,您可以通过阅读 magento 的源代码最终找到答案。如果您不想这样做,请不要以这种方式询问,而是提供有关其工作方式的参考,然后询问它是否不起作用,因为您希望它会起作用。但除非,要么检查来源或咨询支持。