【问题标题】: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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-13
    • 2013-04-30
    • 2022-06-12
    • 1970-01-01
    • 2017-05-23
    • 2019-03-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多