Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2010
    Location
    France
    Posts
    279
    Plugin Contributions
    0

    Default tpl_search_header does not search in the description products

    I read several posts in the forum, I set to search for the file in description but nothing not search
    $content .= zen_draw_hidden_field('search_in_description', '1') . zen_hide_session_id();

    However if I use the advanced search works fine, to complicate matters are not able to do accept keywords to pluriale research.
    thanks for the help
    Giovanni,
    Zen Cart V1.5.8 + templates ZCA Bootstrap Template

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: tpl_search_header does not search in the description products

    Quote Originally Posted by diamond1 View Post
    search
    $content .= zen_draw_hidden_field('search_in_description', '1') . zen_hide_session_id();
    That is a very explicit search query that could easily 'fail' for many reasons.

    If *I* were trying to find a line of code like that, my 1st query would be for
    'search_in_description'

    If that gave too many result for my needs, I'd narrow it down with a query:
    zen_draw_hidden_field('search_in_description'

    Then if needed:
    $content .= zen_draw_hidden_field('search_in_description'

    I can't imagine any situation where the ". zen_hide_session_id();" would be a relevant to what you are actually seeking.

    Just my 2cents

    Cheers
    RodG

  3. #3
    Join Date
    Jan 2010
    Location
    France
    Posts
    279
    Plugin Contributions
    0

    Default Re: tpl_search_header does not search in the description products

    Hello Rod, I'm sorry I did not understand will be the translation, I forgot to mention that use suggestion box.
    PHP Code:
    <?php
    require('includes/application_top.php');

    if (isset(
    $_GET['action'])) { 
        switch(
    $_GET['action']) {
            case 
    'suggestion.search':
                if (isset(
    $_GET['keyword'])) {
                    
    $keywords trim($_GET['keyword']);
                    
    $sql "SELECT DISTINCT p.products_image, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.master_categories_id,
                                   p.products_model
                              FROM "
    .TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd
                             WHERE p.products_status = 1
                               AND p.products_id = pd.products_id
                               AND pd.language_id = "
    .(int)$_SESSION['languages_id'];
                    
    $sql .= " AND (";
                    
    zen_parse_search_string(stripslashes($_GET['keyword']), $search_keywords);
                    for (
    $i=0$n=sizeof($search_keywords); $i<$n$i++ ) {
                      switch (
    $search_keywords[$i]) {
                        case 
    '(':
                        case 
    ')':
                        case 
    'and':
                        case 
    'or':
                        
    $sql .= " " $search_keywords[$i] . " ";
                        break;
                        default:
                        
    $where_str "(pd.products_name LIKE '%:keywords%' OR p.products_model LIKE '%:keywords%'";
                
                        
    $sql .= $db->bindVars($where_str':keywords'$search_keywords[$i], 'noquotestring');
                
                        
    $sql .= ')';
                        break;
                      }
                    }
                    
    $sql .= " ) ORDER BY p.products_sort_order, pd.products_name";
                    
                    
    $result = new splitPageResults($sqlMAX_DISPLAY_SUGGESTION'p.products_id''page');
                    
                    if (
    $result->number_of_rows 0) {
                        
    $listing $db->Execute($result->sql_query);                
                        
    $show_divider false;
                        while(!
    $listing->EOF) {
                            
    $image zen_image(DIR_WS_IMAGES $listing->fields['products_image'], $listing->fields['products_name'], SUGGESTION_IMAGE_WIDTHSUGGESTION_IMAGE_HEIGHT'class="suggestionImage"');
                            
    $name $listing->fields['products_name'];
                            
    $model $listing->fields['products_model'];
                            
    $brand zen_get_products_manufacturers_name($listing->fields['products_id']);
                            
    $price zen_get_products_display_price($listing->fields['products_id']);
                            
    $link zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' zen_get_generated_category_path_rev($listing->fields['master_categories_id']) . '&products_id=' $listing->fields['products_id']);
                            if (
    $show_divider) { ?><hr /><?php }
                            include(
    'search_api_response.php');
                            
    $listing->MoveNext();
                            
    $show_divider true;
                        }
                        
    $nextPage = (int)$result->number_of_pages != (int)$result->current_page_number;
                        
    $prevPage = (int)$result->number_of_pages && (int)$result->current_page_number != 1;
                        
    ?>
                        <div id="suggestionPaging">
                            <table width="100%" cellpadding="0" cellspacing="0">
                                <tr><td width="33%"><?php if ($prevPage) { ?><span id="suggestionPrev">&laquo; Prec.</span><?php ?></td>
                                    <td width="33%"><span id="suggestionCount"><?= $result->current_page_number ?> su <?= $result->number_of_pages ?> Pag.</span></td>
                                    <td width="33%"><?php if ($nextPage) { ?><span id="suggestionNext">Succ. &raquo;</span><?php ?></td>
                                </tr>
                            </table>
                        </div>
                        <?php
                    
    }
                }
                break;
        }
    }
    require(
    'includes/application_bottom.php');
    Giovanni,
    Zen Cart V1.5.8 + templates ZCA Bootstrap Template

  4. #4
    Join Date
    Jan 2010
    Location
    France
    Posts
    279
    Plugin Contributions
    0

    Default Re: tpl_search_header does not search in the description products

    No one can help me? for me it is important.
    Giovanni,
    Zen Cart V1.5.8 + templates ZCA Bootstrap Template

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: tpl_search_header does not search in the description products

    Quote Originally Posted by diamond1 View Post
    No one can help me? for me it is important.
    I don't think we understand the question or problem that you are having.

    It seems to me like you are saying that the search code doesn't search in the product descriptions. The thing is, it *does* do this for the rest of us, so why not you?

    It could be (as per my original reply) that your search query is too specific, or perhaps you are searching for code rather than content?

    I'm not sure what the purpose is for posting that code snippet. All that seems to be showing us is that the SQL does indeed search the TABLE_PRODUCTS_DESCRIPTION

    How about if you provide a link to your site along with information as to what you are searching for, the results you are expecting vs the results you are getting we'll have a better idea what you are asking?

    Cheers
    RodG

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

    Default Re: tpl_search_header does not search in the description products

    If you are searching on a ZenCart frontend(customer side) for
    Code:
    $content .= zen_draw_hidden_field('search_in_description', '1') . zen_hide_session_id();
    Then you will not get any hits
    The frontend search is not intended to locate lines of code
    Zen-Venom Get Bitten

  7. #7
    Join Date
    Jan 2010
    Location
    France
    Posts
    279
    Plugin Contributions
    0

    Default Re: tpl_search_header does not search in the description products

    Thanks Rod, thanks kobra, I apologize for my bad English, I am of French mother tongue and I have to translate online and often does not translate what I write. I installed a module that displays a preview image and link product a bit like the form Numix. What I want to do is that when looking for a product in the search box header can do the research even in the product description as in advabce search. Also I'd like to adavance search form could also work there, because when your site is seen with smartphones research products header is disabled goes directly in advance search. I would like to give you the link of the website, but unfortunately the form is already installed on a test server that is blocked with IP address so RewriteCond% {REMOTE_ADDR}! ^ 83 \ .9 \ .215 \ .18 $

    If you want to help me give me your IP in private that I put in to access the site.

    Thank you in advance for helping.
    Giovanni,
    Zen Cart V1.5.8 + templates ZCA Bootstrap Template

  8. #8
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: tpl_search_header does not search in the description products

    Quote Originally Posted by diamond1 View Post
    Thanks Rod, thanks kobra, I apologize for my bad English,
    No need to apologise for something you have no control over. It just takes a little more patience that's all. :-)

    Quote Originally Posted by diamond1 View Post
    What I want to do is that when looking for a product in the search box header can do the research even in the product description as in advabce search.
    Aha! No problem.

    Load the file
    /includes/templates/YOURTEMPLATE/sideboxes/tpl_search_header.php into a text editor

    Change this line
    Code:
      $content .= zen_draw_hidden_field('search_in_description', '0') . zen_hide_session_id();  // Default to NOT search in description
    To this
    Code:
      $content .= zen_draw_hidden_field('search_in_description', '1') . zen_hide_session_id();  // Default TO search in description
    Quote Originally Posted by diamond1 View Post
    Also I'd like to advance search form could also work there, because when your site is seen with smartphones research products header is disabled goes directly in advance search.
    I'm not quite sure about this one, because whether the search box is shown in the header at all (regardless of whether viewed on a smartphone or not) is a function of whatever template/theme you are using.

    Anyway, hopefully this helps solve part of the problem.

    Cheers
    RodG

  9. #9
    Join Date
    Jan 2010
    Location
    France
    Posts
    279
    Plugin Contributions
    0

    Default Re: tpl_search_header does not search in the description products

    Thanks Rod, is already on 1, I once again explained hurt is I apologize. I have a drop down list when you type in the search box shows me a preview of the products without going in advance search page (as ill InstantSearch module) and it is them who do not look at the product description.
    Thanks a lot
    Giovanni,
    Zen Cart V1.5.8 + templates ZCA Bootstrap Template

  10. #10
    Join Date
    Jan 2010
    Location
    France
    Posts
    279
    Plugin Contributions
    0

    Default Re: tpl_search_header does not search in the description products

    Good morning, I finally resolved I put the solution maybe can help someone, it was enough to change this line
    PHP Code:
    $where_str "(pd.products_name LIKE '%:keywords%' OR p.products_model LIKE '%:keywords%'"
    to
    PHP Code:
    $where_str "(pd.products_name LIKE '%:keywords%' OR p.products_model LIKE '%:keywords%' OR pd.products_description LIKE '%:keywords%'"
    Thank you all for putting me on the right track
    Giovanni,
    Zen Cart V1.5.8 + templates ZCA Bootstrap Template

 

 

Similar Threads

  1. v151 Want to search by title and not description (already checked the other post)
    By mrcastle in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 21 May 2015, 01:58 AM
  2. v139h Limit the search default to only search titles and not description
    By amyleew in forum General Questions
    Replies: 6
    Last Post: 31 Dec 2013, 07:22 AM
  3. Replies: 0
    Last Post: 21 Mar 2013, 12:10 PM
  4. Search Button in tpl_search_header
    By justme86 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 16 Nov 2009, 12:28 AM
  5. Short Description does not show not on search results !
    By Alex123 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 19 Jun 2008, 09:42 AM

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