Search Results Loop error

General ShopSite user discussion

Search Results Loop error

Postby dZi » Tue Feb 26, 2008 8:21 am

I have 8 Test products all called Singing Bowl (#), like Singing Bowl 1, Singing Bowl 2, etc.

Sometimes they show up fine, with all my html in tact and no duplicate search results, and other times they show up almost fine except Singing Bowl 8 is duplicated at the end. And other times, all the HTML AFTER my Search Results Loop is cut off(biggest problem). All of this happens despite what I search for, at random. Here is the code:

[-- IF SEARCHTOP --]
<!-- START Top Search Result Form -->
<tr>
<td class="se_search_form"><table class="se_search_form">
<tbody>
<tr class="se_form_search_row">
<td colspan="4" class="se_form_term">[-- SEARCHRESULT_FORM FORM_ONLY --]</td>
</tr>
<tr class="se_form__sort_row">
<td class="se_form_sort">[-- SearchSortBy --]</td>
<td class="se_form_numresult">[-- SearchResultCount --]</td>
<td class="se_form_prevnext">[-- SearchPrevNext --]</td>
<td class="se_form_perpage">[-- SearchResultsPerPage --]</form></td>
</tr>
</tbody>
</table></td>
</tr>
<!-- END Top Search Result Form -->
[-- END_IF --]
<h2 id="pageName">[--Store.SearchResults --]: [-- SearchString --]</h2><br><table border="0" cellpadding="5" width="95%"><tr>
<p>[-- LOOP SEARCH 8 --]<td>
[-- IF SEARCHLINK --]
<!--
[-- END_IF --]

[-- SEARCHRESULT --]</td>

[-- IF SEARCHLINK --]
-->
[-- END_IF --]
[-- END_LOOP SEARCH--] </tr>
<div class="text1">
[-- IF SEARCHTOP --]
<div class="searchResultForm">

</div>
[-- END_IF --]

[-- VAR.anyresults "no" --]
[-- VAR.resultcount 0 --]
<table class="pa_products">
<tr>
[-- LOOP SEARCH --]
[-- VAR.anyresults "yes" --]
[-- IF SEARCHPRODUCT --]
[-- IF VAR.resultcount VAR.pr_cols --]
</td></tr><tr>
[-- VAR.resultcount 0 --]
[-- END_IF --]
[-- IF VAR.resultcount 0 --]
<td class="pa_product">
[-- ELSE --]
</td><td class="pa_product">
[-- END_IF --]
[-- VAR.resultcount INC --]
[-- END_IF --]
[-- IF SEARCHLINK --]
<div class="searchResultLink">
[-- SEARCHRESULT --]
</div>
[-- ELSE --]
<div class="searchResultPage">
<div></div>
</div>
[-- END_IF --]
[-- END_LOOP SEARCH --]
</td>
</tr>
</table>

[-- IF VAR.anyresults "no" --]
<h4>[-- Store.SearchNoResults --] [-- SearchString --]</h4>
[-- END_IF --]
</div>

[-- IF SEARCHBOTTOM --]
<div class="searchResultForm">

</div><!-- end searchResultForm -->
[-- END_IF --]

</div><!-- end text1 -->

[-- IF PAGE.Text3 --]
<div class="text3">
[-- PAGE.Text3 --]
</div>
[-- END_IF --]
dZi
 
Posts: 96
Joined: Wed Feb 20, 2008 1:10 pm

Postby Jim » Tue Feb 26, 2008 11:51 am

Why do you have multiple [-- LOOP SEARCH --] sections? You only need one on the page otherwise you will have the search results being displayed once for each [-- LOOP SEARCH --] section.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby dZi » Thu Feb 28, 2008 9:10 am

My Search Results page is working now that I took out the extra loop, but I always get this error:

searchtest [214]: Template Error: SEARCHPRODUCT not in LOOP_SEARCH loop
searchtest [226]: Template Error: SEARCHLINK not in LOOP_SEARCH loop

So I just want to take out those two tags all together, but then it skews my layout. Is there anyway I can take those out without messing up the layout, here is my Code:

<!-- END Top Search Result Form -->
[-- END_IF --]
<h2 id="pageName">[--Store.SearchResults --]: [-- SearchString --]</h2><br><table border="0" cellpadding="5" width="1000"><tr>
<p>[-- LOOP SEARCH 8 --]<td>
[-- IF SEARCHLINK --]
<!--
[-- END_IF --]

[-- SEARCHRESULT --]</td>

[-- IF SEARCHLINK --]
-->
[-- END_IF --]
[-- END_LOOP SEARCH--] </tr>
<div class="text1">
[-- IF SEARCHTOP --]
<div class="searchResultForm">

</div>
[-- END_IF --]

[-- VAR.anyresults "no" --]
[-- VAR.resultcount 0 --]
<table class="pa_products">
<tr>

[-- VAR.anyresults "yes" --]
[-- IF SEARCHPRODUCT --]
[-- IF VAR.resultcount VAR.pr_cols --]
</td></tr><tr>
[-- VAR.resultcount 0 --]
[-- END_IF --]
[-- IF VAR.resultcount 0 --]
<td class="pa_product">
[-- ELSE --]
</td><td class="pa_product">
[-- END_IF --]
[-- VAR.resultcount INC --]
[-- END_IF --]
[-- IF SEARCHLINK --]
<div class="searchResultLink">
[-- SEARCHRESULT --]
</div>
[-- ELSE --]
<div class="searchResultPage">
<div></div>
</div>
[-- END_IF --]

</td>
</tr>
</table>

[-- IF VAR.anyresults "no" --]
<h4>[-- Store.SearchNoResults --] [-- SearchString --]</h4>
[-- END_IF --]
</div>

[-- IF SEARCHBOTTOM --]
<div class="searchResultForm">

</div><!-- end searchResultForm -->
[-- END_IF --]

</div><!-- end text1 -->

[-- IF PAGE.Text3 --]
<div class="text3">
[-- PAGE.Text3 --]
</div>
[-- END_IF --]
dZi
 
Posts: 96
Joined: Wed Feb 20, 2008 1:10 pm

Postby Jim » Thu Feb 28, 2008 9:27 am

in the error message the format is
template name [ line number ]: specific error.

So the error message below indicates the problem is in a template called "searchtest" on line number 214

searchtest [214]: Template Error: SEARCHPRODUCT not in LOOP_SEARCH loop

and another error occurs on line 226.

If you count the line numbers you will find the offending lines of code that contain the terms SEARCHPRODUCT and SEARCHLINK which can only be used within a [-- LOOPSEARCH --] [-- END_LOOPSEARCH --] section but which are now outside of that loop.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 143 guests