如何在用户定义的值中显示下拉值?

时间:2017-12-12 16:11:19

标签: php woocommerce

我有一个动态来自数据库的下拉列表列表,我必须将其显示为用户定义的值。如何修改来自foreach的循环值并在下拉列表中显示它。

$statuses = wc_get_order_statuses();

输出:

            Array
(
    [wc-pending] => Pending Payment
    [wc-processing] => Processing
    [wc-on-hold] => On Hold
    [wc-completed] => Completed
    [wc-cancelled] => Cancelled
    [wc-refunded] => Refunded
    [wc-failed] => Failed
)




            foreach ( $statuses as $status => $status_name ) {
                echo '<option value="' . esc_attr( $status ) . '" ' . '>' . esc_html( $status_name ) . '</option>';
            }

如何根据以下顺序显示它:

payment received 
-programming
-approval pending
-production
-shipped 
-cancelled    
-pending payment 
-refunded
-on hold

0 个答案:

没有答案