You are here:  » External Sort Search Results

Support Forum



External Sort Search Results

Submitted by Stew on Tue, 2010-08-24 13:38 in

Hi there,

Apologies if this has been covered before - I've had a look and can't find it!

I am using wordpress to display a page of external results.

I would like to display links on my page above my results so that users can sort by price e.g:

"Order by Price: Low to High, High to Low"

BUT I'd like my page that displays the results to default to PriceAsc before the Order links are clicked.

For example I have a page and I am using the calling code:

<?php
$external_productbaseHREF 
"/products/";
$external_baseHREF "http://www.mysite.com";
$external_path "/home/public_html/mysite.com/price/";
$_GET["q"] = 'my query';
 
$_GET["sort"] = "priceAsc";
require(
$external_path."external.php");
?>

So here the results are sorted by priceAsc by default, but when I click on my "High to Low" link the results do not change to priceDesc (I have hard coded the Order By links e.g: High to Low - not sure if thats the best way to do that!)

Hope that makes sense!

Many Thanks

Stew

Submitted by support on Tue, 2010-08-24 13:47

Hi Stew,

In your calling code, replace this line:

  $_GET["sort"] = "priceAsc";

...with:

  if (!$_GET["sort"]) $_GET["sort"] = "priceAsc";

...and that will stop it overriding the user selection...

Cheers,
David.
--
PriceTapestry.com

Submitted by Stew on Tue, 2010-08-24 14:34

Excellent - Many thanks