System.xml Зависимости в группах / полей
-
13-12-2019 - |
Вопрос
System.xml позволяет нам делать видимость отдельных полей зависящих от значений из других полей.Статья GoTo, конечно, от Alan Storm: в глубине настройки системы Magento
Это выглядит что-то подобное (я заимствовал свой пример код здесь):
Location: app/code/local/Alanstormdotcom/Helloworld/etc/system.xml
<config>
<tabs>
<helloconfig translate="label" module="helloworld">
<label>Hello Config</label>
<sort_order>99999</sort_order>
</helloconfig>
</tabs>
<sections>
<helloworld_options translate="label" module="helloworld">
<label>Hello World Config Options</label>
<tab>helloconfig</tab>
<frontend_type>text</frontend_type>
<sort_order>1000</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<notes translate="label">
<label>Demo Of Config Fields NOTES</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>
<fields>
<enabled translate="label">
<label>Enabled</label>
<frontend_type>select</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>
</enabled>
<hello_note>
<label>Message</label>
<frontend_type>text</frontend_type>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<depends>
<enabled>1</enabled>
</depends>
</hello_note>
</fields>
</notes>
<messages translate="label">
<label>Demo Of Config Fields MESSAGES</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>
<fields>
<hello_message>
<label>Message</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>
</hello_message>
<hello_time>
<label>Time to Say Hello</label>
<frontend_type>time</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>
</hello_time>
</fields>
</messages>
</groups>
</helloworld_options>
</sections>
.
Поскольку это, кажется, работает только с полями внутри одной и той же группы / поля (<notes>
в этом примере), я хочу знать: есть ли способ сделать генеракодицетагCode из группы <hello_message>
, зависящей от <messages>
из группы <enabled>
?
Решение
После
Не связан с magento.stackexchange