Fix order settings.

This commit is contained in:
Hoang Huu 2019-10-31 10:58:21 +07:00
parent 56e6f75efb
commit 5af63726c3
3 changed files with 15 additions and 14 deletions

View File

@ -168,10 +168,10 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'desc' => esc_html__( 'Show featured first in page result, as default Newest is showed', 'opalestate-pro' ), 'desc' => esc_html__( 'Show featured first in page result, as default Newest is showed', 'opalestate-pro' ),
'type' => 'switch', 'type' => 'switch',
'options' => [ 'options' => [
0 => esc_html__( 'Disable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
1 => esc_html__( 'Enable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'default' => 0, 'default' => 'off',
]; ];
$fields[] = [ $fields[] = [
'name' => esc_html__( 'Minimum of Search Price', 'opalestate-pro' ), 'name' => esc_html__( 'Minimum of Search Price', 'opalestate-pro' ),

View File

@ -177,10 +177,10 @@ class Opalestate_Property_MetaBox {
'id' => $prefix . 'featured', 'id' => $prefix . 'featured',
'type' => 'switch', 'type' => 'switch',
'options' => [ 'options' => [
0 => esc_html__( 'No', 'opalestate-pro' ), 'on' => esc_html__( 'Yes', 'opalestate-pro' ),
1 => esc_html__( 'Yes', 'opalestate-pro' ), 'off' => esc_html__( 'No', 'opalestate-pro' ),
], ],
'default' => 0, 'default' => 'off',
], ],
[ [
'name' => esc_html__( 'Property SKU', 'opalestate-pro' ), 'name' => esc_html__( 'Property SKU', 'opalestate-pro' ),
@ -206,17 +206,14 @@ class Opalestate_Property_MetaBox {
'id' => $prefix . 'enablemapview', 'id' => $prefix . 'enablemapview',
'type' => 'switch', 'type' => 'switch',
'options' => [ 'options' => [
1 => esc_html__( 'Yes', 'opalestate-pro' ), 'on' => esc_html__( 'Yes', 'opalestate-pro' ),
0 => esc_html__( 'No', 'opalestate-pro' ), 'off' => esc_html__( 'No', 'opalestate-pro' ),
], ],
], ],
[ [
'name' => esc_html__( 'Address', 'opalestate-pro' ), 'name' => esc_html__( 'Address', 'opalestate-pro' ),
'id' => $prefix . 'address', 'id' => $prefix . 'address',
'type' => 'textarea_small', 'type' => 'textarea_small',
'attributes' => [
'required' => 'required',
],
], ],
[ [
'id' => "{$prefix}video", 'id' => "{$prefix}video",
@ -270,10 +267,10 @@ class Opalestate_Property_MetaBox {
'id' => $prefix . 'price_oncall', 'id' => $prefix . 'price_oncall',
'type' => 'switch', 'type' => 'switch',
'options' => [ 'options' => [
0 => esc_html__( 'No', 'opalestate-pro' ), 'on' => esc_html__( 'Yes', 'opalestate-pro' ),
1 => esc_html__( 'Yes', 'opalestate-pro' ), 'off' => esc_html__( 'No', 'opalestate-pro' ),
], ],
'default' => 0, 'default' => 'off',
], ],
]; ];

View File

@ -245,6 +245,10 @@ class OpalEstate_Search {
$args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . $ksearchs[0]; $args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . $ksearchs[0];
$args['orderby'] = 'meta_value_num'; $args['orderby'] = 'meta_value_num';
$args['order'] = $ksearchs[1]; $args['order'] = $ksearchs[1];
} elseif ( 'on' == opalestate_options( 'show_featured_first', 'off' ) ) {
$args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . 'featured';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
} }
$metas = Opalestate_Property_MetaBox::metaboxes_info_fields(); $metas = Opalestate_Property_MetaBox::metaboxes_info_fields();