Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Adding custom data to search results

    Hello, I'm trying to add extra info to the products name section of the search result.

    I've added new columns to the products_description table and would like to be able to call these columns and show this relevant data from them below the products name in the search results....

    I can't figure out how to get the listing results to pull the data from these extra columns.

    Any help would be greatly appreciated.

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Adding custom data to search results

    You might follow steps in this thread changing the file for the page you want

    http://www.zen-cart.com/showthread.p...Page&p=1219365
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Adding custom data to search results

    I'm trying to add

    Code:
    <h3 class="itemTitleES">Also Found In: <a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '"><strong>' . $listing->fields['products_also_found_in_1'] . '<strong></a></h3>
    into the code in file modules/MYTEMPLATE/product_listing.php

    around this point

    Code:
            case 'PRODUCT_LIST_NAME':
              $lc_align = '';
              if (isset($_GET['manufacturers_id'])) {
                $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
              } else {
                $lc_text = '<h2 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h2>
    <h3 class="itemTitleES">EasySearch ID: <a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '"><strong>ES' . $listing->fields['products_id'] . '<strong></a></h3>
    <h3 class="itemTitleES">Also Found In: <a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '"><strong>' . $listing->fields['products_also_found_in_1'] . '<strong></a></h3>
    <div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
              }
              break;
    Where do i need to add the calls to pd.also_found_in_1? Does it go in the header.php for advanced search result? or somewhere else?

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Adding custom data to search results

    I've added new columns to the products_description table
    You did not state what these are.... maybe you should add them to the "products" table
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Adding custom data to search results

    as i'm pulling the products_name from the same table, i thought it would be easy to grab other columns from the same table.

  6. #6
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Adding custom data to search results

    Anyone, surely this is simple, I've added custom fields to almost every other page, but I can't figure out how to do the search results page.

  7. #7
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Adding custom data to search results

    Is there no one who can help?

    I can't figure out which file I need to edit so i can call these tables from the search results page.

    Please...

  8. #8
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Adding custom data to search results

    Quote Originally Posted by DigitalShadow View Post
    Is there no one who can help?

    I can't figure out which file I need to edit so i can call these tables from the search results page.

    Please...
    I have posted code to add addition fields to almost every page within ZC, the product_listing page is a little tricky but very doable. Take a look at this thread.

  9. #9
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Adding custom data to search results

    also needed to modify advanced_search_result/header_php.php

    but it is done now, thankyou!

  10. #10
    Join Date
    Mar 2009
    Posts
    609
    Plugin Contributions
    0

    Default Re: Adding custom data to search results

    One question in product_listing.php I would like to put an if statement, this is my current code and it works fine. However, I only want it to display the Part Also Found In text if the table also_found_in_1 is populated.

    Code:
    case 'PRODUCT_LIST_NAME':
              $lc_align = '';
              if (isset($_GET['manufacturers_id'])) {
                $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
              } else {
                $lc_text = '<h2 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h2>
    <h3 class="itemTitleES">EasySearch ID: <a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '"><strong>ES' . $listing->fields['products_id'] . '<strong></a></h3>
    <h3 class="itemTitleAFI">Part Also Found In: ' . $listing->fields['also_found_in_1'] . ' ' . $listing->fields['also_found_in_2'] . ' ' . $listing->fields['also_found_in_3'] . ' ' . $listing->fields['also_found_in_4'] . ' ' . $listing->fields['also_found_in_5'] . ' ' . $listing->fields['also_found_in_6'] . ' ' . $listing->fields['also_found_in_7'] . ' ' . $listing->fields['also_found_in_8'] . ' ' . $listing->fields['also_found_in_9'] . ' ' . $listing->fields['also_found_in_10'] . ' ' . $listing->fields['also_found_in_11'] . ' ' . $listing->fields['also_found_in_12'] . ' ' . $listing->fields['also_found_in_13'] . ' ' . $listing->fields['also_found_in_14'] . ' ' . $listing->fields['also_found_in_15'] . ' ' . $listing->fields['also_found_in_16'] . ' ' . $listing->fields['also_found_in_17'] . ' ' . $listing->fields['also_found_in_18'] . ' ' . $listing->fields['also_found_in_19'] . ' ' . $listing->fields['also_found_in_20'] . ' ' . $listing->fields['also_found_in_21'] . ' </h3>
    <div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
              }
              break;

    Elsewhere on the website I have used this code

    Code:
    <?php if (empty($also_found_in_1)) { echo ''; } else { echo 'Please note that this part has also been fitted to these alternative TV models:<div id="also_found">'; } ?>
    How could I modify that so it works on the search results page.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Custom Search or Manufacturer Results Page
    By joew36 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 Mar 2012, 09:25 PM
  2. Custom Page with search results
    By tini1709 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 4 Nov 2010, 10:45 AM
  3. Custom search results pages
    By mediathing in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 Dec 2007, 08:01 PM
  4. custom search results
    By saikii in forum General Questions
    Replies: 0
    Last Post: 8 Jun 2007, 02:14 AM
  5. Where Do I Find The Search Results Data
    By profitshock in forum General Questions
    Replies: 1
    Last Post: 6 Dec 2006, 06:41 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR