Results 1 to 10 of 10

Hybrid View

  1. #1
    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

  2. #2
    Join Date
    Jan 2010
    Location
    France
    Posts
    291
    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 V2.1

  3. #3
    Join Date
    Jan 2010
    Location
    France
    Posts
    291
    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 V2.1

  4. #4
    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

 

 

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

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