【问题标题】:Magento 2 - add Multiselect Status in admin FormMagento 2 - 在管理表单中添加多选状态
【发布时间】:2017-06-29 00:23:04
【问题描述】:
我正在 Magento 2 中开发一个自定义模块。我想在编辑表单中添加一个多选,以允许用户选择订单的状态。在 Magento 1.9 中是这样完成的:
Mage::getModel('sales/order_status')->getResourceCollection()->getData();
如何在 Magento 2 中做到这一点?
【问题讨论】:
标签:
php
magento
module
magento2
【解决方案1】:
您可以将此代码添加到 {Vendor}/{Module}/etc/adminhtml/system.xml
<field id="order_status" translate="label" type="multiselect" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Order status</label>
<source_model>Magento\Sales\Model\Config\Source\Order\Status</source_model>
<comment>Select the status for the orders to be exported</comment>
</field>