• AtanasAnnaAnna
    July 29, 2014 at 1:51 pm #55267

    I want to ask how can sort the results of the advanced search page, ordered by price is my goal.

    —answer—

    Instruction before 1.10 theme update

    advanced_search_results.php

    Look for

    'meta_key'        => 'prop_featured',
    'orderby'         => 'meta_value',
    'order'           => 'DESC',

    Replace with

            'meta_key'        => 'property_price',
            'orderby'         => 'meta_value_num',
            'order'           => 'ASC',

    Make sure you write PHP, not copy/paste. So you don’t copy wrong formatting.

    Modify in 2 places:

    2015-01-31_12-55-51

    You also need to remove some ordering filters

    add_filter( 'posts_orderby', 'wpestate_my_order' );

     

     

    Instruction after 1.10 theme update

    In this case the place to edit is searchfunctions.php at line 307

    ‘meta_key’ => ‘prop_featured’,

    ‘orderby’ => ‘meta_value’,

    ‘order’ => ‘DESC’,

    Also in advanced_Search_results.php you may need to remove the filters at line 96 : add_filter( ‘posts_orderby’, ‘wpestate_my_order’ );

    • This topic was modified 2 years, 8 months ago by  Anna.
    • This topic was modified 2 years, 1 month ago by  Anna.
    • This topic was modified 2 years, 1 month ago by  Anna.
    • This topic was modified 2 years, 1 month ago by  Anna.
    • This topic was modified 1 year, 10 months ago by  Anna.
    • This topic was modified 1 year, 10 months ago by  Anna.
    • This topic was modified 1 year, 4 months ago by  Camelia Support Team - WP Estate.
    Anna
    July 30, 2014 at 7:44 am #55530

    Hi Atanas

    In theory, these are the settings.

    advanced_search_results.php

    Look for

    ‘posts_per_page’ => 30,
    ‘meta_key’ => ‘prop_featured’,
    ‘orderby’ => ‘meta_value’,
    ‘order’ => ‘DESC’,
    ‘meta_query’ => $meta_query,

    Replace with

    ‘posts_per_page’ => 30,
    ‘meta_key’ => ‘property_price’,
    ‘orderby’ => ‘meta_value_num’,
    ‘order’ => ‘DESC’,
    ‘meta_query’ => $meta_query,

    Make sure you write PHP, not copy/paste. So you don’t copy wrong formatting.

    Thank you
    Anna

    • This reply was modified 2 years, 7 months ago by  Anna.
    elliottagain
    October 8, 2014 at 9:57 am #99741

    Hi Anna,

    Trying to change advanced_search_results.php to show results starting with cheapest price first; ‘ASC’

    We have changed the code as below but not working, any ideas please?

    //////////////////////////////////////////////////////////////////////////////////////
    ///// compose query
    //////////////////////////////////////////////////////////////////////////////////////
    $args = array(
    ‘post_type’ => ‘estate_property’,
    ‘post_status’ => ‘publish’,
    ‘paged’ => $paged,
    ‘posts_per_page’ => 30,
    ‘meta_key’ => ‘property_price’,
    ‘orderby’ => ‘meta_value_num’,
    ‘order’ => ‘ASC’,
    ‘meta_query’ => $meta_query,
    ‘tax_query’ => array(
    ‘relation’ => ‘AND’,
    $categ_array,
    $action_array,
    $city_array,
    $area_array
    )
    );

    Many thanks
    Elliott

You must be logged in to reply to this topic.

'
Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.