Dropdowns for country in order admin

This commit is contained in:
Mike Jolley 2012-02-26 16:31:58 +00:00
parent fd40fc7839
commit a3772cd463
3 changed files with 34 additions and 7 deletions

View File

@ -16,7 +16,7 @@
*/
function woocommerce_order_data_meta_box($post) {
global $post, $wpdb, $thepostid, $order_status;
global $post, $wpdb, $thepostid, $order_status, $woocommerce;
$thepostid = $post->ID;
@ -117,7 +117,9 @@ function woocommerce_order_data_meta_box($post) {
),
'country' => array(
'label' => __('Country', 'woocommerce'),
'show' => false
'show' => false,
'type' => 'select',
'options' => $woocommerce->countries->get_allowed_countries()
),
'state' => array(
'label' => __('State/County', 'woocommerce'),
@ -147,7 +149,15 @@ function woocommerce_order_data_meta_box($post) {
echo '<div class="edit_address"><p><button class="button load_customer_billing">'.__('Load customer billing address', 'woocommerce').'</button></p>';
foreach ( $billing_data as $key => $field ) :
woocommerce_wp_text_input( array( 'id' => '_billing_' . $key, 'label' => $field['label'] ) );
if (!isset($field['type'])) $field['type'] = 'text';
switch ($field['type']) {
case "select" :
woocommerce_wp_select( array( 'id' => '_billing_' . $key, 'label' => $field['label'], 'options' => $field['options'] ) );
break;
default :
woocommerce_wp_text_input( array( 'id' => '_billing_' . $key, 'label' => $field['label'] ) );
break;
}
endforeach;
echo '</div>';
@ -188,7 +198,9 @@ function woocommerce_order_data_meta_box($post) {
),
'country' => array(
'label' => __('Country', 'woocommerce'),
'show' => false
'show' => false,
'type' => 'select',
'options' => $woocommerce->countries->get_allowed_countries()
),
'state' => array(
'label' => __('State/County', 'woocommerce'),
@ -212,7 +224,15 @@ function woocommerce_order_data_meta_box($post) {
echo '<div class="edit_address"><p><button class="button load_customer_shipping">'.__('Load customer shipping address', 'woocommerce').'</button></p>';
foreach ( $shipping_data as $key => $field ) :
woocommerce_wp_text_input( array( 'id' => '_shipping_' . $key, 'label' => $field['label'] ) );
if (!isset($field['type'])) $field['type'] = 'text';
switch ($field['type']) {
case "select" :
woocommerce_wp_select( array( 'id' => '_shipping_' . $key, 'label' => $field['label'], 'options' => $field['options'] ) );
break;
default :
woocommerce_wp_text_input( array( 'id' => '_shipping_' . $key, 'label' => $field['label'] ) );
break;
}
endforeach;
echo '</div>';

View File

@ -222,7 +222,8 @@ mark.amount {
display: block;
padding: 0 0 3px;
}
#order_data .order_data_right .form-field input {
#order_data .order_data_right .form-field input,
#order_data .order_data_right .form-field select {
width: 95%;
}
#order_data .order_data_right ._billing_company_field,
@ -234,6 +235,9 @@ mark.amount {
#order_data .order_data_right ._shipping_company_field input {
width: 97.5%;
}
#order_data .order_data_right ._billing_email_field {
clear: left;
}
#order_data .order_data_right div.edit_address {
display: none;
overflow: hidden;

View File

@ -199,7 +199,7 @@ mark.amount {
display: block;
padding: 0 0 3px;
}
input {
input, select {
width: 95%;
}
}
@ -210,6 +210,9 @@ mark.amount {
width: 97.5%;
}
}
._billing_email_field {
clear: left
}
div.edit_address {
display: none;
overflow: hidden;