PDA

View Full Version : Adding Category Name?


Bluesplayer
06-02-09, 12:39
How do I add the category name to product.tpl at the top of the site?

Where it says 'Search Results' on my site here (http://ukshopping-4u.com/shopwindow/productlist.php?q=Accommodation). I would like it to display the category name instead.

Regards
Bluesplayer

Bud
06-02-09, 13:31
I believe this is in \elements\filters.tpl

I haven't switched to V2.0 yet but have just run a search through the client download and there's only one result showing for "Search Results".

If you're interested, I used a great little free download called "Simple Search and Replace". I've found this essential for finding bits of code etc.

Thoroughly Recommended: http://www.rjlsoftware.com/software/utility/search/

Hope that helps.

Andy
06-02-09, 13:32
Its alot simpler than you think.

There are a few different ways, but seeing as that page is a search, you could create a new smarty variable from $_GET['q'] in productlist.php, eg:


$oSmarty->assign('sMySearchTerm', $_GET['q']);


then replace "Search Results" with {$sMySearchTerm}

Maybe add some sanity checks first though.

Bluesplayer
06-02-09, 15:20
Hi

The 2nd solution gave me an idea so I used this code from the search box tpl:

{$sSearchTerm}

This works perfectly in this line:

Search Results For: {$sSearchTerm}

Problem I have now is that nothing will show if a category is clicked upon. To take this further I need to be able to show the category name and then control the output by if and else statements. How to show a clicked upon category name?