• 1dnmr
    April 30, 2015 at 6:40 am #107554

    Hi,

    Here is the solution.
    1. Add custom fields “price mix”, “price max”

    2. Put this function to you local functions.php

    
    /////////////////////////////////////////////////////////////////////////////////
    // show price range
    ///////////////////////////////////////////////////////////////////////////////////
    
    function wpestate_show_price_range($post_id,$currency,$where_currency,$return=0){
          
        $price_label    = '<span class="price_label">'.esc_html ( get_post_meta($post_id, 'property_label', true) ).'</span>';
    
        $price_from     = intval( get_post_meta($post_id, 'min-price', true) );
        $price_to       = intval( get_post_meta($post_id, 'max-price', true) );            
        
        $th_separator   =get_option('wp_estate_prices_th_separator','');
        $custom_fields = get_option( 'wp_estate_multi_curr', true);
        //print_r($_COOKIE);
        if( !empty($custom_fields) && isset($_COOKIE['my_custom_curr']) &&  isset($_COOKIE['my_custom_curr_pos']) &&  isset($_COOKIE['my_custom_curr_symbol']) && $_COOKIE['my_custom_curr_pos']!=-1){
            $i=intval($_COOKIE['my_custom_curr_pos']);
            $custom_fields = get_option( 'wp_estate_multi_curr', true);
            if ($price_from != 0) {
                $price_from      = $price_from * $custom_fields[$i][2];
                $price_from      = number_format($price_from,0,'.',$th_separator);
               
                $currency   = $custom_fields[$i][0];
                
                if ($custom_fields[$i][3] == 'before') {
                    $price_from = $currency . $price_from;
                } else {
                    $price_from = $price_from . $currency;
                }
                
            }else{
                $price_from='';
            }
    
            if ($price_to != 0) {
                $price_to      = $price_to * $custom_fields[$i][2];
                $price_to      = number_format($price_to,0,'.',$th_separator);
               
                $currency   = $custom_fields[$i][0];
                
                if ($custom_fields[$i][3] == 'before') {
                    $price_to = $currency . $price_to;
                } else {
                    $price_to = $price_to . $currency;
                }
                
            }else{
                $price_to='';
            }
    
        }else{
            if ($price_from != 0) {
               $price_from = number_format($price_from,0,'.',$th_separator);
    
                if ($where_currency == 'before') {
                    $price_from = $currency . $price_from;
                } else {
                    $price_from = $price_from . $currency;
                }
                
            }else{
                $price_from='';
            }
    
            if ($price_to != 0) {
               $price_to = number_format($price_to,0,'.',$th_separator);
    
                if ($where_currency == 'before') {
                    $price_to = $currency . $price_to;
                } else {
                    $price_to = $price_to . $currency;
                }
                
            }else{
                $price_to='';
            }
    
        }
        
      
        
        if($return==0){
            print $price_from.' - '.$price_to.' '.$price_label;
        }else{
             return $price_from.' - '.$price_to.' '.$price_label;
        }
    }
    
    /////////////////////////////////////////////////////////////////////////////////
    // show price range
    ///////////////////////////////////////////////////////////////////////////////////
    
    

    3. Use in single-estate_property.php template like this

    
      <div class=" <?php print $options['content_class'];?> ">
            <?php get_template_part('templates/ajax_container'); ?>
            <?php
            while (have_posts()) : the_post();
                $price          =   intval   ( get_post_meta($post->ID, 'property_price', true) );
                $price_from     =   esc_html( get_post_meta($post->ID, 'min-price', true) );
                $price_to       =   esc_html( get_post_meta($post->ID, 'max-price', true) );            
                $price_label    =   esc_html ( get_post_meta($post->ID, 'property_label', true) );  
                $image_id       =   get_post_thumbnail_id();
                $image_url      =   wp_get_attachment_image_src($image_id, 'property_full_map');
                $full_img       =   wp_get_attachment_image_src($image_id, 'full');
                $image_url      =   $image_url[0];
                $full_img       =   $full_img [0];    
                if ($price_from != 0 && $price_to != 0) {
                    $price = wpestate_show_price_range(get_the_ID(),$currency,$where_currency,1);   
                } 
                else if ($price != 0) {
                   $price = wpestate_show_price(get_the_ID(),$currency,$where_currency,1);  
                }else{
                   $price='';
                }
            ?>
    
    • This topic was modified 1 year, 11 months ago by  Anna.
    Camelia Support Team - WP Estate
    May 26, 2015 at 12:35 pm #109090

    Thank you for deciding to share your solution with other clients. That’s very kind of you. Camelia

    gaurav
    July 18, 2015 at 8:13 am #115823

    can you please share link of page where you have implemented this code.

    tystra
    July 27, 2015 at 4:38 am #117256

    I would also love to see a page where this is displayed, thanks in advance!

    1dnmr
    July 27, 2015 at 5:00 am #117258

    Hi guys,

    Here the page example http://villasonsamui.ru/properties/villa-beige/
    Tell the truth I spend two month customising the theme. many code rewrote, many new added. Original theme has HUGE count of minor defects in CSS, especially when you want to see you theme truly responsive.

    • This reply was modified 1 year, 11 months ago by  Anna.

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.