You are here:  » Small edits to search results pages

Support Forum



Small edits to search results pages

Submitted by oliver on Wed, 2007-12-19 16:51 in

Hi David

I'm looking to strip out most of the content from the search results pages, so that they just list the product name and the header info.

In other words could you please let me know how to remove the photos, prices and more information links?

I've tried scouring the code for clues about where this gets populated from but couldn't work it out.

Thanks very much

Oliver

Submitted by support on Wed, 2007-12-19 17:14

Hello Oliver,

It's probably easiest to write the code you want to display the results from scratch rather than cut down the current version as generated by html/searchresults.php

That file is included by search.php with the following code (look near the bottom):

require("html/searchresults.php");

At that point, you could replace that code with the following PHP if you just want a list of products, nothing more:

foreach($searchresults["products"] as $product)
{
  print "<p>".$product["name"]."</p>";
}

If you want the product name linked to the product page, it's just slightly more code as follows:

foreach($searchresults["products"] as $product)
{
  print "<p><a href='".$product["href"]."'>".$product["name"]."</a></p>";
}

Hope this helps!
Cheers,
David.

Submitted by oliver on Wed, 2007-12-19 17:29

Hi David

Thanks - I tried the second piece of code but I get this error:

Parse error: syntax error, unexpected T_ELSE in /var/www/vhosts/MYURLHERE.com/PATH/PATH/search.php on line 7

I wonder if you could check that code is correct or am I missing something out?
Thanks
Oliver

Submitted by support on Wed, 2007-12-19 17:36

Hi Oliver,

I'm slightly confused by the error message as presumably you made the changes down at the bottom of search.php, nowhere near line 7...!

Feel free to email me your modified search.php (reply to your forum registration or reg code email) and i'll take a look if you like...

Cheers,
David.

Submitted by oliver on Wed, 2007-12-19 17:50

Thanks, I've emailed it.