浏览文章
文章信息
magento2 system.xml 设置依赖字段 | Magento2 set system.xml | depends
12459
依赖主要代码
<depends>
<field id="section_id/group_id/field_id">1</field>
</depends>
依赖示例:依赖web/type的值
... <field id="type" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>是否A类型网站</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <comment>网站A/B类型,Yes(A),No(B).</comment> </field> <field id="pay_sku" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>跳转后支付产品的sku(这个产品不会在B站前台可见)</label> <comment>跳转到B站后会检测这个产品存不存在,不存在会新建这个sku的产品,用于支付时静默状态新建订单是价格的承载商品,可用于识别特定A站的支付订单.</comment> <validate>required-entry</validate> <depends> <field id="Aiweline_PaymentGateway_admin/web/type">1</field> </depends> </field> <field id="pay_sku_title" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>跳转后支付产品的标题(这个产品不会在B站前台可见)</label> <comment>来自A站的承载商品标题,可用于识别特定A站的支付订单.</comment> <validate>required-entry</validate> <depends> <field id="Aiweline_PaymentGateway_admin/web/type">1</field> </depends> </field> <field id="pay_sku_stock" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>跳转后支付产品的默认库存</label> <comment>来自A站的承载商品库存,库存不足时会翻倍设置库存.</comment> <validate>required-entry</validate> <depends> <field id="Aiweline_PaymentGateway_admin/web/type">1</field> </depends> </field> ...