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

@ -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' ),
'type' => 'switch',
'options' => [
0 => esc_html__( 'Disable', 'opalestate-pro' ),
1 => esc_html__( 'Enable', 'opalestate-pro' ),
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'default' => 0,
'default' => 'off',
];
$fields[] = [
'name' => esc_html__( 'Minimum of Search Price', 'opalestate-pro' ),

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

@ -245,6 +245,10 @@ class OpalEstate_Search {
$args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . $ksearchs[0];
$args['orderby'] = 'meta_value_num';
$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();