Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Posts
    40
    Plugin Contributions
    0

    Default Editing the Search Result Page?

    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!

  2. #2
    Join Date
    Feb 2009
    Posts
    95
    Plugin Contributions
    0

    Default Re: Editing the Search Result Page.

    Try putting:
    PHP Code:
    <?php echo $sData['keyword']; ?>
    Where you want the keyword to appear.

  3. #3
    Join Date
    Feb 2009
    Posts
    40
    Plugin Contributions
    0

    Default Re: Editing the Search Result Page?

    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

    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'); 
    How can i get that variable inside the single quotes?

  4. #4
    Join Date
    Feb 2009
    Posts
    95
    Plugin Contributions
    0

    Default Re: Editing the Search Result Page?

    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
    PHP Code:
    <h1 id="advSearchDefaultHeading"><?php echo HEADING_TITLE_1?></h1>
    with
    PHP Code:
    <h1 id="advSearchDefaultHeading"><?php echo $sData['keyword']; ?></h1>
    You could also add your custom text in front like this:
    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

  5. #5
    Join Date
    Feb 2009
    Posts
    40
    Plugin Contributions
    0

    Default Re: Editing the Search Result Page?

    Ahh! I'm starting to see how Zencart works now... Thank you so much for your help.

    So I replaced
    PHP Code:
    <h1 id="advSearchResultsDefaultHeading"><?php echo HEADING_TITLE?></h1>
    with:

    PHP Code:
    <h1 id="advSearchDefaultHeading">Search results for: <?php echo $sData['keyword']; ?></h1>
    but the HTML output is only:

    <h1 id="advSearchDefaultHeading">Search results for: </h1>

    Any reason why it wouldn't get passed through?

  6. #6
    Join Date
    Feb 2009
    Posts
    95
    Plugin Contributions
    0

    Default Re: Editing the Search Result Page?

    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:
    PHP Code:
    <h1 id="advSearchDefaultHeading">Search Results For: <?php echo $_GET['keyword']; ?></h1>
    $_GET['keyword'] should work as long as the keyword is present in the url of the page.

  7. #7
    Join Date
    Feb 2009
    Posts
    95
    Plugin Contributions
    0

    Default Re: Editing the Search Result Page?

    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.

  8. #8
    Join Date
    Feb 2009
    Posts
    40
    Plugin Contributions
    0

    Default Re: Editing the Search Result Page?

    Quote Originally Posted by jwitt98 View Post
    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:
    PHP Code:
    <h1 id="advSearchDefaultHeading">Search Results For: <?php echo $_GET['keyword']; ?></h1>
    $_GET['keyword'] should work as long as the keyword is present in the url of the page.

    This is perfect and works flawlessly. Thank you so much!

    The only issue now is getting that to the <title>.

  9. #9
    Join Date
    Feb 2009
    Posts
    95
    Plugin Contributions
    0

    Default Re: Editing the Search Result 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:
    PHP 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; 
    Change "You Searched For: " to whatever you want it to read
    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

  10. #10
    Join Date
    Feb 2009
    Posts
    40
    Plugin Contributions
    0

    Default Re: Editing the Search Result Page?

    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!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 15 May 2012, 06:31 PM
  2. Search Result page, meta modification
    By DigitalShadow in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 Jan 2012, 12:16 AM
  3. EZ-Page Search Result Display
    By dmfelder in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 Dec 2008, 12:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg