You are here:  » All items below £1

Support Forum



All items below £1

Submitted by jonny5 on Tue, 2007-09-25 17:15 in

Hi , Is there a search string I can use to show all items in the database , say below £1 ?

Submitted by support on Tue, 2007-09-25 17:25

Hi Jonny,

There isn't, but one can be easily added!

In search.php, look for the following code on line 73:

default:

...and insert the following new search string case immediately BEFORE that line:

      case "price":
        $sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `".$config_databaseTablePrefix."products` WHERE price >= '".database_safe($parts[1])."' AND price <= '".database_safe($parts[2])."' GROUP BY name";
        $sqlResultCount = "SELECT COUNT(DISTINCT(name)) as resultcount FROM `".$config_databaseTablePrefix."products` WHERE price >= '".database_safe($parts[1])."' AND price <= '".database_safe($parts[2])."'";
        $orderBySelection = $orderByDefault;
        $sort = "priceAsc";
        break;

This will give you a new search string that supports the following format:

price:min:max

So, to get all products up to £1, use:

price:0.00:1.00

You can link directly to those results of course, something like this:

http://www.yoursite.com/search.php?q=price:0.00:1.00

Hope this helps!
Cheers,
David.

Submitted by jonny5 on Tue, 2007-09-25 19:18

many thanks

Submitted by jonny5 on Sun, 2007-09-30 19:08

I assume this could be added to the merchants search (merchants.php) so it shows all items from a certain retailer that are below £1??

search.php?q=merchant:Currys + search.php?q=price:0.00:2.00

so can these search strings be added together (i have tried )

thanks

Submitted by support on Mon, 2007-10-01 09:45

Hi Jonny,

It wouldn't work in that format, but I will send you some code so that you can do that...

Cheers,
David.

Submitted by jonny5 on Mon, 2007-10-01 10:42

thanks