Search results craziness

Questions and answers about ShopSite Custom Templates

Search results craziness

Postby dnrbookstore » Mon Jul 12, 2010 3:34 pm

Here is a link to a page where you can test my cart...

http://www.mapstore.utah.gov/index.html

I've set the search results up to show 4 results wide in a rown (image on top of title on top of price) and continue down the page. Whats happening is that when I perform a search, say for "gold" the results don't show up in the 4 columns. Well let me clarify, sometimes they do, sometimes they don't; Sometimes its 2 on a row, sometimes 4, sometimes 1, and all without any seeming reason why.

Can anyone help? Thanks in advance.

Here is the code I've used for the search_product file

# <!-- search_product -->
[-- DEFINE PRODUCT --]
<td align="center">
[-- IF PRODUCT.DisplayGraphic "checked" --]
[-- IF PRODUCT.Graphic --]
<span class="product_img" align="center" valign="bottom"><a href="[-- PRODUCT.MoreInfoURL --]" >[-- PRODUCT.Graphic --]</a></span><br />
[-- END_IF --]
[-- END_IF --]
<br />
<span align="center">
<a href="[-- PRODUCT.MoreInfoURL --]" ><b>[-- PRODUCT.Name --]</b></a>
</span>
<br />
<span align="center" valign="bottom">
[-- IF PRODUCT.NumSubproducts 0 --]
[-- IF PRODUCT.DisplayPrice --]
[-- IF PRODUCT.SaleOn --]
<span style="text-decoration: line-through;">[-- PRODUCT.Price --]</span>
<b>[-- PRODUCT.SaleAmount --]</b>
[-- ELSE --]
[-- PRODUCT.Price --]
[-- END_IF --]
[-- IF PRODUCT.QuantityPricing --]
[-- STORE.QuantityPricingFlag --]
[-- VAR.Quantityproduct "yes" --]
[-- END_IF --]
[-- IF PRODUCT.VariablePrice? --]
[-- STORE.VariablePricingFlag --]
[-- VAR.Variableproduct "yes" --]
[-- END_IF --]
[-- END_IF --]
[-- END_IF --]
</span>
<br /><br />
</td>

[-- END_DEFINE PRODUCT --]


Oh also, on a side topic, is there a quick way that will align the results to the top of the row?

Thanks in advance for you help!
dnrbookstore
 
Posts: 11
Joined: Mon Apr 05, 2010 3:03 pm
Location: utah

Postby ShopSite Lauren » Mon Jul 12, 2010 5:21 pm

That is happening because the search results include both product results and page link results. ShopSite is creating a new row after every 4 results, not after every 4 product results. There are a few ways around this.

- You can go to Products > Edit Product Info, and set the search destination for ALL products to "more info". Then for your search results specify that you want 8 per row. This will guarantee that all products have one product result and one page result.

- You can change your product template so that each product is a table which is aligned left and has the width of 25% of the page. Then instead of using the [-- LOOP SEARCHRESULTS Page.Columns --] tag, you would just use [-- LOOP SEARCHRESULTS --]. ShopSite will not create rows, they will naturally fall into rows of 4 across because the product tables will have specified heights and widths.

- I haven't tried this last one, but it would probably be the best if it does work. You could setup VAR tags similar to:

[-- VAR.Count 1 --]
<table>
<tr>
[-- LOOP SEARCHRESULTS --]
[-- SEARCHRESULT --]
[-- IF VAR.Count 4 --]
</tr>
<tr>
[-- END_IF --]
[-- END_LOOP SEARCHRESULTS --]
</tr>
</table>

And in your search result product template you would want to include
[-- VAR.Count INC --]
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 887
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Postby dnrbookstore » Tue Jul 13, 2010 7:42 am

Ooh great ideas! Thank you for the explanation and help. It makes a little more sense now. I was so confused.

I used your last idea. It worked great. I just had to start the count at 0 and then reset it after 4. So this worked:

#Start of the loop to output the search results - Products with associated Links

[-- VAR.Count 0 --]
<table border="0" cellpadding="8" width="100%">
[-- VAR.pa_search_result "false" --]
<tr valign="top">[-- LOOP SEARCH --]

[-- SEARCHRESULT --]

[-- IF VAR.Count 4 --]
</tr><tr>
[-- VAR.Count 0 --]
[-- END_IF --]
[-- VAR.pa_search_result "true" --]
[-- END_LOOP SEARCH--]</tr>
</table>

Thanks!!!
Last edited by dnrbookstore on Tue Jul 13, 2010 8:04 am, edited 1 time in total.
dnrbookstore
 
Posts: 11
Joined: Mon Apr 05, 2010 3:03 pm
Location: utah

Postby Jim » Tue Jul 13, 2010 7:59 am

[-- VAR.Count 1 --]
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 107 guests