Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Search term in search results title

Search term in search results title

Views: 995

Results 1 to 6 of 6
21 Nov 2014, 3:47 PM
#1
pricediscrimination avatar

pricediscrimination

Zen Follower

Join Date:
May 2008
Posts:
401
Plugin Contributions:
0

Search term in search results title

When you search, the title of the search results says "Advanced Search" and the breadcrumbs trail is "Home > Advanced Search > Search Results" but is there a way to make the term you searched for the title and breadcrumbs to be "Home > Advanced Search > Term You Searched For"?

8 Feb 2016, 8:23 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Search term in search results title

A couple small changes:

  1. /includes/modules/metatags.php
    insert the 3 lines as shown:
  case 'advanced_search_result':
[B]  define('META_TAG_TITLE', NAVBAR_TITLE_2 . ' -> ' . zen_output_string_protected($keywords) . ' ' . PRIMARY_SECTION . TITLE . TAGLINE);
  define('META_TAG_DESCRIPTION', '');
  define('META_TAG_KEYWORDS', '');[/B]
  break;
  case 'password_forgotten':
  1. /includes/modules/pages/advanced_search_result/header_php.php
    near the bottom of the file, add this line, as shown:
$breadcrumb->add(NAVBAR_TITLE_2);
[B]$breadcrumb->add(zen_output_string_protected($keywords));[/B]
9 Feb 2016, 8:07 PM
#3
pricediscrimination avatar

pricediscrimination

Zen Follower

Join Date:
May 2008
Posts:
401
Plugin Contributions:
0

Re: Search term in search results title

Awesome, thank you so much! I also needed to make the search result show in the page heading, so I did an ugly hack because I don't know how to do it the right way:

in tpl_advanced_search_result_default.php changed:

<h1 id="advSearchResultsDefaultHeading"><?php echo HEADING_TITLE; ?></h1> to <h1 id="advSearchResultsDefaultHeading"><?php echo META_TAG_TITLE; ?></h1>
9 Feb 2016, 8:56 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Search term in search results title

That's one way ... or:```

<h1 id="advSearchResultsDefaultHeading"><?php echo [B]zen_output_string_protected($keywords)[/B]; ?></h1> ```
9 Feb 2016, 8:58 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Search term in search results title

BTW, the code from post #2 above is scheduled to be included in the upcoming v155 release: https://github.com/zencart/zencart/pull/819

11 Feb 2016, 1:32 AM
#6
pricediscrimination avatar

pricediscrimination

Zen Follower

Join Date:
May 2008
Posts:
401
Plugin Contributions:
0

Re: Search term in search results title

DrByte:

That's one way ... or:```

<h1 id="advSearchResultsDefaultHeading"><?php echo [B]zen_output_string_protected($keywords)[/B]; ?></h1> ```

PERFECT!!! Thank you for this, for everything you've helped me with in the past, and for anything in the future that you kindly help with!