diff --git a/class/class.apop.apop_ui.php b/class/class.apop.apop_ui.php index de76817..eb6120b 100644 --- a/class/class.apop.apop_ui.php +++ b/class/class.apop.apop_ui.php @@ -302,7 +302,7 @@ value="' . esc_html( $sort_num ) . '"> $no_order_class = $cnv_order_params['no_order_class']; $field_metakey_input = ''; $name_use_key = '_' . $name_key . '[' . $target_key . '][use]'; - $name_sort_key = '_' . $name_key . '[' . $target_key . '][ sort ]'; + $name_sort_key = '_' . $name_key . '[' . $target_key . '][sort]'; if ( strpos( $target_key, 'custom_field' ) !== false ) { $meta_key = $cnv_order_params[ $target_key ]['meta_key']; $value_type = $cnv_order_params[ $target_key ]['value_type']; diff --git a/css/apop-style.css b/css/apop-style.css index b0a3998..74abc48 100644 --- a/css/apop-style.css +++ b/css/apop-style.css @@ -165,6 +165,11 @@ dl.apop_setting_list_dd dd input { width: calc((100% / 4) - 5px); } +.search_normal_sort .product-list-sort-type label:first-of-type { + width: 5em; + margin-right: 3em; +} + .product-list.no_order { background: #ababab; } @@ -294,6 +299,10 @@ dl.apop_setting_list_dd dd input { .search_normal_sort .product-list-sort-type label { width: calc((100% / 3) - 5px); } + + .search_normal_sort .product-list-sort-type label:first-of-type { + margin-right: 1em; + } } @media only screen and (max-width: 964px) { diff --git a/util/apop-order-setting.php b/util/apop-order-setting.php index d8e48d0..4c1baef 100644 --- a/util/apop-order-setting.php +++ b/util/apop-order-setting.php @@ -90,9 +90,8 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) { private static function set_custom_filed_sort( &$orderby, $order_col, $orders, $sort_param ): array { if ( strpos( $order_col, 'custom_field' ) !== false ) { - $meta_key = APOP_CUSTOM_FIELD_PREFIX . $orders['field']['meta_key']; - $orderby_sort = $orders['sort']; - $type = 'CHAR'; + $meta_key = APOP_CUSTOM_FIELD_PREFIX . $orders['field']['meta_key']; + $type = 'CHAR'; if ( $orders['field']['value_type'] == 'meta_value_num' ) { $type = 'NUMERIC'; } elseif ( $orders['field']['value_type'] == 'meta_value' ) { @@ -100,7 +99,9 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) { } elseif ( $orders['field']['value_type'] == 'meta_date' ) { $type = 'DATE'; } - $orderby[ $meta_key ] = $sort_param[ $orderby_sort ]; + if ( isset( $orders['sort'] ) ) { + $orderby[ $meta_key ] = $sort_param[ $orders['sort'] ]; + } return array( $meta_key, $type ); } @@ -188,7 +189,9 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) { list( $sort_meta_key, $type ) = self::set_custom_filed_sort( $orderby, $order_col, $orders, $sort_param ); $meta_query[] = self::get_all_post_args( $sort_meta_key, $type ); } else { - $orderby[ $order_col ] = $sort_param[ $orders['sort'] ]; + if ( isset( $orders['sort'] ) ) { + $orderby[ $order_col ] = $sort_param[ $orders['sort'] ]; + } } } }