Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1

I have built a simple search engine with 1 dropdown menu being a filter.
Here's my code:

Code: Select all
<cms:form name="quicksearch" id="quicksearch" anchor='0'>
    <cms:if k_success >

     <cms:if frm_product_category!='-' >
        <cms:set my_search_str="<cms:concat my_search_str ' | product_category==' frm_product_category />"  scope='global'/>
      <cms:if frm_string!='' >
        <cms:set my_search_str="<cms:concat my_search_str ' | product_name==' frm_string/>"  scope='global'/>
      <div class="w-col w-col-4">
      <label><cms:if k_lang='en'>Keywords<cms:else_if k_lang='fr' />Mots-clés</cms:if></label>
      <cms:input type="text" class="w-input" name="string" id="string" />

    <div class="w-col w-col-4">
      <label><cms:if k_lang='en'>Categories<cms:else_if k_lang='fr' />Catégories</cms:if></label>
      <cms:input type="dropdown" class="w-select"
          opt_values="- | <cms:embed 'produits-categories-groulx.php'/>"
          name="product_category" id="product_category" />
    <div class="w-col w-col-4">
            <cms:input type="submit" class="search-button w-button" value="<cms:if k_lang='en'>Search<cms:else_if k_lang='fr' />Trouver</cms:if>" name="submit"/>


Search with the "Categories" dropdown works just fine.
But when I enter keywords (single or multiple) in the "string" field, it's being added to the URL query, but nothing shows up. The page loads, but there's nothing in the result section. Am I doing something wrong here?

Thanks a lot!
Any ideas? I'm really stuck here. Been trying out different stuff for hours but I really don't understand what's going on.

Thanks in advance for the support!
The code you posted shows only one half of the equation (namely, how the search string is fabricated).
The second half where we actually use the search string to fetch in pages is likely to contain the error.

Please post that part of the code too.
I see. Here's the other part, sorry :

Code: Select all
    <div class="results-container">

      <cms:pages paginate='1' limit='6' custom_field="<cms:show my_search_str />" orderby=page_title >

<div class="product-block">

<a href="<cms:show product_image/>" class="glightbox" data-glightbox="title:<cms:show k_page_title/> - #<cms:show product_code/>;">
   <img src="<cms:show product_image/>" alt="" class="image-2">

          <h3 class="product-name"><cms:show k_page_title/></h3>
          <div class="text-block-2">#<cms:show product_code/></div>
          <div class="products-size-container">
            <cms:if product_format_custom><cms:show product_format_custom/><cms:else/>
            <cms:each product_format sep='|'>
           <div class="product-size"><cms:show item /></div>

<cms:if product_description>
              <div class="product-description">

          <p class="product-desc-p">
            <cms:show product_description/>


                    <div class="product-buttons-container"><a href="<cms:show product_pdf_security/>" class="products-buttons w-button">Fiche signalétique</a><a href="<cms:show product_pdf/>" class="products-buttons w-button">Fiche technique</a></div>


         <cms:paginator />

The code seems to be fine.
To debug the issue, try using hardcoded values for the search e.g.
Code: Select all
<cms:set my_search_str="hardcode search values here" />
<h3>Searching for <cms:show my_search_str  /></h3>

<cms:pages paginate='1' limit='6' custom_field="<cms:show my_search_str />" orderby=page_title >

In the code above we are also outputting the string being searched for visual confirmation.

Try using different values.
If that works, remove the line explicitly setting the search value and then try inputting it into the original search box.
See if it shows up as the original value (do a view-source to double check the output).

This should yield some clue as to what is going wrong.
Hope this helps,
5 posts Page 1 of 1