Template Error: SEARCHPRODUCT, SEARCHLINK not found in loop

General ShopSite user discussion

Template Error: SEARCHPRODUCT, SEARCHLINK not found in loop

Postby dZi » Mon Mar 10, 2008 6:49 am

Hi,

I really like how my Search template looks at this point. The only thing is, at the bottom of the page I get this error that pops up when I am searching for products:

searchtest [260]: Template Error: SEARCHPRODUCT not in LOOP_SEARCH loop
searchtest [272]: Template Error: SEARCHLINK not in LOOP_SEARCH loop


I really just don't want those two Tags in my template, but when I take them out I get this error. I have tried to stick them into the loop as well and they will not work. Here is the loop I am currently using...


<table border="0" cellpadding="0" cellspacing="0" width="990"><tr>
<p>[-- LOOP SEARCH 8 --]<td width="246">
[-- SEARCHRESULT --]</td>[-- END_LOOP SEARCH--]
</tr>

Thanks
dZi
 
Posts: 96
Joined: Wed Feb 20, 2008 1:10 pm

Postby Jim » Mon Mar 10, 2008 7:10 am

The tags [-- SEARCHPRODUCT --] and [-- SEARCHLINK --] are not valid tags. They must always be used as IF statements like [-- IF SEARCHPRODUCT --] and [-- IF SEARCHLINK --] and must be between the tags [-- LOOP SEARCH --] and [-- END_LOOP SEARCH--] if they are not then you will get the errors reported. The actual search results, either the product itself or the link to the page where the product is found, are displayed using the tag [-- SEARCHRESULT --] so an appropriate use of the tag combination would be

Code: Select all
[-- LOOP SEARCH 8 --]
   [-- IF SEARCHPRODUCT --]
# start any special formatting required when displaying the product result
     [-- SEARCHRESULT --]
# end any special formatting required when displaying the product result
   [-- END_IF --]
   [-- IF SEARCHLINK --]
# start any special formatting required when displaying the link
     [-- SEARCHRESULT --]
# end any special formatting required when displaying the link
   [-- END_IF --]
[-- END_LOOP SEARCH--]


NOte that your used without the [-- IF SEARCHPRODUCT --] and [-- IF SEARCHLINK --] should work also but the same formatting will be applied to both the product and the link for the product.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby dZi » Mon Mar 10, 2008 11:27 am

I put in the following...just as you said and I still get the same error


[-- LOOP SEARCH 8 --]<td width="246">
[-- IF SEARCHPRODUCT --]
# start any special formatting required when displaying the product result
[-- SEARCHRESULT --]</td>
# end any special formatting required when displaying the product result
[-- END_IF --]
[-- IF SEARCHLINK --]
# start any special formatting required when displaying the link
[-- SEARCHRESULT --]
# end any special formatting required when displaying the link
[-- 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 » Mon Mar 10, 2008 12:32 pm

What I showed was a sample of how it would be but you have not included the formatting where indicated by the lines starting with #

It looks like this section of code is where you are including the tags that are not inside the [-- LOOP SEARCH --] section.

<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>


First remove the code that you pasted in from my example. Next edit the code I quoted and fix it to include the [-- LOOP SEARCH --] and [-- END_LOOP SEARCH --] tags.

You would probably want to put the [-- LOOP SEARCH --] in the first blank line after <tr> and put the [-- END_LOOP SEARCH--] in the blank line at the end just under [-- END_IF --]

You might have to do some tweaking with where table tags such as <tr></tr><td></td> etc are located to get the formatting the way it should be.
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: No registered users and 86 guests