marcellino (October 17th, 2012)
function cp_refine_search_builder($results) {
global $wpdb;
$cp_min_price = str_replace( ',', '', $wpdb->get_var( "SELECT min( CAST( meta_value AS UNSIGNED ) ) FROM $wpdb->postmeta WHERE meta_key = 'cp_price'" ) );
$cp_max_price = str_replace( ',', '', $wpdb->get_var( "SELECT max( CAST( meta_value AS UNSIGNED ) ) FROM $wpdb->postmeta WHERE meta_key = 'cp_price'" ) );
$locarray = array();
function cp_refine_search_builder($results) {
global $wpdb, $post;
//$cp_min_price = str_replace( ',', '', $wpdb->get_var( "SELECT min( CAST( meta_value AS UNSIGNED ) ) FROM $wpdb->postmeta WHERE meta_key = 'cp_price'" ) );
//$cp_max_price = str_replace( ',', '', $wpdb->get_var( "SELECT max( CAST( meta_value AS UNSIGNED ) ) FROM $wpdb->postmeta WHERE meta_key = 'cp_price'" ) );
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
query_posts( array('post_type' => APP_POST_TYPE, 'post_status' => 'publish', 'posts_per_page'=>'-1', 'ad_cat'=>$term->slug) );
if ( have_posts() ) :
the_post();
$cp_min_price =get_post_meta($post->ID, 'cp_price', true);
$cp_max_price =get_post_meta($post->ID, 'cp_price', true);
while (have_posts()) : the_post();
if ($cp_max_price < get_post_meta($post->ID, 'cp_price', true))
$cp_max_price = get_post_meta($post->ID, 'cp_price', true);
if ($cp_min_price > get_post_meta($post->ID, 'cp_price', true))
$cp_min_price = get_post_meta($post->ID, 'cp_price', true);
endwhile;
while (have_posts()) : the_post();
if ($cp_max_price < get_post_meta($post->ID, 'cp_price', true))
$cp_max_price = get_post_meta($post->ID, 'cp_price', true);
endwhile;
endif;
$locarray = array();
marcellino (October 17th, 2012)
There are currently 1 users browsing this thread. (0 members and 1 guests)