Search Result layout displays differently based on Criteria

General ShopSite user discussion

Search Result layout displays differently based on Criteria

Postby dZi » Tue Mar 11, 2008 7:12 am

http://69.94.126.135/shop/

User:robcat82@gmail.com
pass:password

If you go there and search for "bracelet", you will see that all of the items looks great! But then if I search for "tibet" or especially, "bowl", the items are all over the place and a mess. I don't understand how the Search criteria is affecting my layout....
dZi
 
Posts: 96
Joined: Wed Feb 20, 2008 1:10 pm

Postby Jim » Tue Mar 11, 2008 8:27 am

This is typical of when a product is assigned to multiple pages but your code in the custom template does not take that into account. So each time the Loop is executed an extra td is output for the second and following links but there is no code to display the link so you end up with a blank table cell.

The only way around it is to keep track of how many links are out put for a product and not to output the <td> sequence for any link except the first one associated with the product.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby dZi » Tue Mar 11, 2008 9:03 am

Is there a IF statement or tag I could add to the loop to prevent it from creating these extra <td>?


My code:

<br><table border="0" cellpadding="0" cellspacing="0" width="990"><tr>
<p>

<div class="text1">
[-- IF SEARCHTOP --]
<div class="searchResultForm">

</div>
[-- END_IF --]

[-- VAR.anyresults "no" --]
[-- VAR.resultcount 0 --]
<table width="990" class="pa_products">
<tr>[-- LOOP SEARCH 8 --]<td width="246">

[-- VAR.anyresults "yes" --]
[-- IF SEARCHPRODUCT --]
[-- IF VAR.resultcount VAR.pr_cols --]

[-- VAR.resultcount 0 --]
[-- END_IF --]
[-- IF VAR.resultcount 0 --]

[-- ELSE --]

[-- END_IF --]
[-- VAR.resultcount INC --]
[-- END_IF --]
[-- IF SEARCHLINK --]

[-- SEARCHRESULT --]</td>

[-- ELSE --]

[-- END_IF --][-- END_LOOP SEARCH --]</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 --]



</tr>
</td>
</tr>
dZi
 
Posts: 96
Joined: Wed Feb 20, 2008 1:10 pm

Postby Jim » Tue Mar 11, 2008 8:07 pm

Sorry, I'm really busy right now and don't have time to code out the entire template but here is what you need to do.

Only output the starting <td width="246"> when you are in the
[-- IF SEARCHPRODUCT --] section and not right after the
[-- LOOP SEARCH 8 --]

Then you need to keep track of the fact that the <td> is open and only close it when you start the next [-- IF SEARCHPRODUCT --] or when you have exited the routine at [-- END_LOOP SEARCH --]

so something like
before you start the [-- LOOP SEARCH 8 --] you need to set a VAR to keep track of the state of the <td>

Code: Select all
[-- VAR.TDState closed --]

...
[-- LOOP SEARCH 8 --]
[-- IF SEARCHPRODUCT --]
    [-- if VAR.TDtate open --]
         </td>
         [-- VAR.TDState closed --]
    [-- end_if --]
    <td width="246">
    [-- VAR.TDState open --]
   [-- SEARCHRESULT --]
[-- END_IF --]
   


Then you do your intervening code that you have (I have no idea what you are trying to do there) and you close that section with
Code: Select all
[-- IF SEARCHLINK --]
   [-- SEARCHRESULT --]
[-- END_IF --]
[-- END_LOOP SEARCH --]

[-- IF VAR.TDState open --]
   </td>
   [-- VAR.TDState closed --]
[-- END_IF --]
</tr>


Note that I have not actually run the above code so you may need to do some modification to it. You can look at some of the shopsite search templates that allow columns and see how they are done but they may be more complicated than this.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby dZi » Thu Mar 13, 2008 12:08 pm

I worked on it for a couple of hours but still couldn't get it right, i guess I'm not necessarily even an amateur coder but I've been able to figure out most things. This is really, the last thing I can't figure out, the site is already live.

I know your busy, but if you ever get a chance to test it out or figure out what it should be exactly, that would be awesome.

Thanks,

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

Postby dZi » Thu Mar 27, 2008 8:59 am

Any help with this, its the last thing holding up the site from looking amazing....
dZi
 
Posts: 96
Joined: Wed Feb 20, 2008 1:10 pm

Postby JeremeD » Sat Mar 29, 2008 4:28 am

Rob,

Try this code. It looks like you aren't generating any search links in your search results so I assume you don't want any. What this code does is output only the product matches and not any link matches. Instead of letting shopsite control the number of columns and create extra cells, the columnCounter variable is used to create them.

I haven't tried the code but I think it will work. Just backup your current code and give it a go.

Code: Select all
<table width="900" class="pa_products">
   <tr>
   [-- VAR.columnCounter 1 --]
   [-- LOOP SEARCH --]
   [-- IF SEARCHPRODUCT --]
      <td width="246">[-- SEARCHRESULT --]</td>
      [-- VAR.columnCounter INC --]
      [-- IF VAR.columnCounter 4 --]
         </tr><tr>
         [-- VAR.columnCounter 1 --]
      [-- END_IF --]
   [-- END_IF --]
   [-- END_LOOP SEARCH --]
   </tr>
</table>
SD360.com
Certified ShopSite Designer
ShopSite Templates Available Now
JeremeD
 
Posts: 60
Joined: Sat Feb 10, 2007 4:20 pm
Location: Athens, GA

Postby dZi » Mon Mar 31, 2008 6:45 am

That looks like it did it! Thanks! Hey Jim, thanks anyways!
dZi
 
Posts: 96
Joined: Wed Feb 20, 2008 1:10 pm


Return to User Forum

Who is online

Users browsing this forum: No registered users and 114 guests