You are here:  » Search Results giving odd layout on random pages

Support Forum



Search Results giving odd layout on random pages

Submitted by bem on Sat, 2013-01-26 22:27 in

Hi David ,

I'm having a problem where certain search results listings are giving odd layouts. I've set it to only show 9 as I show 3 items per column. Not a problem on a fair few pages. But when you start searching though the pages you see that some break.

Example is here : {link saved}

This shows as a row of 3, then 1 (positioned to the right), then 3 and then 2.
Yet the 3 pages before then, all show in rows of 3 as it should.

Also, as a side, you might notice that I've done away with the categories page as I only have 2 categories (using the 2 in the menu bar), but the rewrite rules don't seem to work now. Not a biggy really, but do you know why that is as well?

Thanks
Ben

Submitted by support on Sun, 2013-01-27 10:07

Hi Ben,

I think I can see what's happening - it looks like the layout is being achieved with a floating style on each search result , however if you notice the result immediately above the oddly positioned result as a product name that is only on 1 line as compared to the 2 lines of the other results - meaning that the total height of that div is less than the other 2 results on the first line, and the oddly positioned result is floating itself immediately below the shorter result - hence it appears out to the right on its own.

To confirm if that's the case you could put a temporary border on the search results div and that would show what's happening more clearly.

To resolve the problem, one option would be to give each search result div a fixed height. Alternatively, in html/searchresults.php look for the closing endforeach; statement (line 33 in the distribution)

<?php endforeach; ?>

...and immediately before that line, use a counter variable to insert break with clear='all' every 3rd results, e.g.

<?php $c++; if ($c==3) { print "<br clear='all' />"$c=0; } ?>

Regarding the rewrite, it looks like the rules are in place and working fine - all you need to do is update the links in your header to use the rewritten versions in place of the search.php versions - in otherwords, in place of:

/search.php?q=category:Figures

...use:

/category/Figures/

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by babrees on Thu, 2013-01-31 06:33

Another way to solve this is by adding height to your .css

I use the following for my class .featuredproduct

text-align:center;
width:175px;
height:285px;
float:left;
padding: 5px;
margin:2px;
border: 1px solid #000033;
font-weight:bold;

---------
Jill

Submitted by support on Thu, 2013-01-31 09:32

Thanks, Jill!

Cheers,
David.
--
PriceTapestry.com