You are here:  » search results as keyword tags

Support Forum



search results as keyword tags

Submitted by rolli1 on Sat, 2006-12-30 20:40 in

Hi David,
When I execute a search with PT a results page appears with ( in my case ) 10 products showing. How can I manage that in the head of this page the meta keywords tag contains the name of these 10 products?

Regards

Roland

Submitted by support on Sat, 2006-12-30 22:05

Hello Roland,

This can be done quite easily. In search.php, find the loop that goes through the search results...(line 138)

    foreach($searchresults["products"] as $k => $product)
    {

Now, add on the next line (indented with the loop) the following code to build up an array of product names)

      $productNames[] = $product["name"];

Finally, add the following code:

  if (is_array($productNames))
  {
    $header["meta"]["keywords"] = implode(",",$productNames);
  }

...just before the following line:

  require("html/header.php");

That should do the trick...

Cheers,
David.

Submitted by rolli1 on Sun, 2006-12-31 10:03

Works great...Thanks

Roland