Low to High Pricing Broken
-
I’m having issues getting my page to display prices correctly from lowest to highest. It works correctly for highest to lowest price and also works correctly for highest to lowest and lowest to highest cap rate (so basically 1 out of the 4 available sorting options doesn’t work).
I’d also like to have the page default the listings from lowest to highest price as well. I’m not using a plugin for the pricing, here is the most relevant code I’m looking at:
<?php get_header(); ?> <section class="hero-wrap-int" style="height: 0;"> <div class="hero"> </div><!--/hero--> </section><!--/hero-wrap--> <?php $view = 'list'; //If the option form is being submitted, this function runs if($_GET['img_hidden'] == 'Y') { //Replaces the value of each input with the user-defined value $price_prev = $_GET['price_prev']; $price = $_GET['price']; if($price_prev == $price) { $price = ''; } $cap_prev = $_GET['cap_prev']; $cap_rate = $_GET['cap_rate']; if($cap_prev == $cap_rate) { $cap_rate = ''; } $squery = $_GET['squery']; if($cap_rate == '' && $price == '') { $view = $_GET['view']; } else { $view = 'list'; } } ?> <section class="content-wrap int"> <div class="search-bar"> <form name="respond" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" method="get"> <div class="input keyword"> <label>Search</label> <input type="text" placeholder="Enter Keyword" value="<?php echo $squery;?>" id="squery" name="squery" /> <input type="submit" value="" /> </div><!--/input--> <div class="input drop"> <label>Sort by Price</label> <select name="price" id="price" onchange="this.form.submit()"> <option value="">Select</option> <option value="low-high" <?php if($price == 'low-high') { echo 'selected';}?>>Low to High</option> <option value="high-low" <?php if($price == 'high-low') { echo 'selected';}?>>High to Low</option> </select> </div><!--/input--> <div class="input drop"> <label>Sort by Cap Rate</label> <select name="cap_rate" id="cap_rate" onchange="this.form.submit()"> <option value="">Select</option> <option value="low-high" <?php if($cap_rate == 'low-high') { echo 'selected';}?>>Low to High</option> <option value="high-low" <?php if($cap_rate == 'high-low') { echo 'selected';}?>>High to Low</option> </select> </div><!--/input--> <div class="input drop"> <label>View</label> <select name="view" id="view" onchange="this.form.submit()"> <option value="list" <?php if($view == 'list') { echo 'selected';}?>>List</option> <option value="map" <?php if($view == 'map') { echo 'selected';}?>>Map</option> </select> </div><!--/input--> <input type="hidden" name="img_hidden" value="Y" /> <input type="hidden" name="price_prev" value="<?php echo $price;?>" /> <input type="hidden" name="cap_prev" value="<?php echo $cap_rate;?>" /> </form> </div>The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Low to High Pricing Broken’ is closed to new replies.