Does anyone know how to edit the search result page? I'd like to have whatever is searched for (such as "pistachio") to be echo'd and outputted to the pages Title, and within the body of the text.
Any help would be greatly appreciated!![]()
Does anyone know how to edit the search result page? I'd like to have whatever is searched for (such as "pistachio") to be echo'd and outputted to the pages Title, and within the body of the text.
Any help would be greatly appreciated!![]()
Try putting:
Where you want the keyword to appear.PHP Code:<?php echo $sData['keyword']; ?>
Thanks for the help. I've tried inserting it, but it's giving me some php error... But...
I've narrowed the search page to this...
/includes/languages/english/advanced_search_result.php
How can i get that variable inside the single quotes?PHP Code:define('NAVBAR_TITLE_1', 'Advanced Search');
define('NAVBAR_TITLE_2', 'Search Results');
//define('HEADING_TITLE_1', 'Advanced Search');
define('HEADING_TITLE', 'Advanced Search');
I was actually thinking more along these lines:
In \includes\templates\CUSTOM\templates\tpl_advanced_search_default.php
Where CUSTOM is your custom template name,
replace
withPHP Code:<h1 id="advSearchDefaultHeading"><?php echo HEADING_TITLE_1; ?></h1>
You could also add your custom text in front like this:PHP Code:<h1 id="advSearchDefaultHeading"><?php echo $sData['keyword']; ?></h1>
PHP Code:<h1 id="advSearchDefaultHeading">This is the term you searched for: <?php echo $sData['keyword']; ?></h1>
Last edited by jwitt98; 10 Mar 2009 at 01:12 AM. Reason: added final thoughts
Ahh! I'm starting to see how Zencart works now... Thank you so much for your help.
So I replaced
with:PHP Code:<h1 id="advSearchResultsDefaultHeading"><?php echo HEADING_TITLE; ?></h1>
but the HTML output is only:PHP Code:<h1 id="advSearchDefaultHeading">Search results for: <?php echo $sData['keyword']; ?></h1>
<h1 id="advSearchDefaultHeading">Search results for: </h1>
Any reason why it wouldn't get passed through?![]()
Hmm, That strage. It works OK on my site:
It seems for some reason your $sData array has not been assigned a value yet. Maybe try replacing $sData with $_GET like this:
$_GET['keyword'] should work as long as the keyword is present in the url of the page.PHP Code:<h1 id="advSearchDefaultHeading">Search Results For: <?php echo $_GET['keyword']; ?></h1>
You may also want to edit:
\includes\templates\CUSTOM\templates\tpl_advanced_search_result_default.php
as well as:
\includes\templates\CUSTOM\templates\tpl_advanced_search_default.php
The first displays the search results, the second displays the default search page.
OK, the <title> tag requires a bit more work.
in:
\includes\modules\meta_tags.php
***first make a backup of the file!***
comment out the following lines:
case 'advanced_search':
case 'advanced_search_result':
directly under the line: switch ($_GET['main_page']) {
paste the following:
Change "You Searched For: " to whatever you want it to readPHP Code:case 'advanced_search':
define('META_TAG_TITLE', 'You Searched For: '.$_GET['keyword']);
define('META_TAG_DESCRIPTION', TITLE . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . KEYWORDS);
define('META_TAG_KEYWORDS', KEYWORDS . METATAGS_DIVIDER . NAVBAR_TITLE_1);
break;
case 'advanced_search_result':
define('META_TAG_TITLE', 'You Searched For: '.$_GET['keyword']);
define('META_TAG_DESCRIPTION', TITLE . PRIMARY_SECTION . NAVBAR_TITLE_2 . SECONDARY_SECTION . KEYWORDS);
define('META_TAG_KEYWORDS', KEYWORDS . METATAGS_DIVIDER . NAVBAR_TITLE_2);
break;
Just make sure if you use any quotes in your wording to escape them.
Last edited by jwitt98; 12 Mar 2009 at 02:08 AM. Reason: added last precaution
Thank you so much!
I'm impressed. How does one figure all of this out? I spent so much time searching includes for title tags and any variables to point to with no major results!All I've learned so far is that Zen Cart is insanely huge and I've got a lot to learn! :)
Thanks again!