Page 1 of 1

Search Template

PostPosted: Wed Jun 25, 2014 12:32 pm
by Kapitol
I am using the standard format found at
http://www.shopsite.com/templates/cookbook/quick-easy-templates-search.shtml

I have set my templates at Preferences > Search Settings > Search Layout

I want the results of a search to look like the other pages in this site. Each product has to be wrapped in 2 divs
Code: Select all
<div class="col-md-3"><div class="pods thumbnail">

I am attempting to do this in the template code. The results duplicate the above code twice with no results within. They show up as blank divs.
This is the code I am using.
Code: Select all
<div class="searchresults">
    <article>
      <div class="col-md-12"><table style="display:none"> [-- VAR.pa_search_result "false" --]
[-- LOOP SEARCH --]<div class="col-md-3"><div class="pods thumbnail">[-- IF SEARCHLINK --]
<tr>
<td></td>
<td align="left" valign="top">
<b>
[-- END_IF --]
[-- SEARCHRESULT --]
[-- IF SEARCHLINK --]
</b>
</td>
<td></td>
<td></td>
</tr>
[-- END_IF --]
[-- VAR.pa_search_result "true" --]</div></div>
[-- END_LOOP SEARCH--]
[-- IF VAR.pa_search_result "false" --]
<tr><td align="left" valign="top">[-- STORE.88 --] [-- SEARCHSTRING --]</td></tr>
[-- END_IF --]
[-- IF VAR.Quantityproduct "yes" --]
<tr><td>[-- Store.QuantityPricingFlag --] [-- Store.QuantityPricingMsg --]</td></tr>
[-- END_IF --]
[-- IF VAR.Variableproduct "yes" --]
<tr><td>[-- Store.VariablePricingFlag --] [-- Store.VariablePricingMsg --]</td></tr>
[-- END_IF --]
</table></div>
    </article>
   
      <div class="search_term">[-- SEARCHRESULT_FORM FORM_ONLY --]</div>
      <div class="pagination">
      <div class="search_sort">
        <table class="search_sort">
          <tr>
            <td class="sort_by">[-- SearchSortBy --]</td>
            <td class="result_count">[-- SearchResultCount --]</td>
            <td class="prev_next">[-- SearchPrevNext --]</td>
            <td class="per_page">[-- SearchResultsPerPage --]</td>
          </tr>
        </table>
        </form>
      </div>
    </div>
  </div>

This is the search page
http://www.artandsoulbeads.com/cgi-artandsoulbeads/sb/productsearch.cgi?search_field=blue

I need help finding a solution to remove these blank divs. I am using Shopsite 10. Jquery nth-child isn't working.

Re: Search Template

PostPosted: Wed Jun 25, 2014 1:12 pm
by Jim
For one thing the results won't display because you include them inside a <table> that has display: none. Which tells the browser to not display the table content.

I tried to go to your site and do a search but the search box is not visible. I clicked on the search icon and the search box momentarily displays on the right side of the screen under you header but it immediately scrolls down and back up.

Re: Search Template

PostPosted: Wed Jun 25, 2014 1:25 pm
by Kapitol
I set that table to display none on purpose because all it was displaying was a long list of links below the products.
http://imgur.com/bHBgEiR

Try this link
Code: Select all
http://www.artandsoulbeads.com/cgi-artandsoulbeads/sb/productsearch.cgi?storeid=*2c9b6b76a8e4672390b3b067f172f748cd1b3cbb488a47ce&search_field=red

Re: Search Template

PostPosted: Wed Jun 25, 2014 3:53 pm
by Jim
A search result link will be added for each page that the product is displayed on which is why you are seeing all the links.

You can get around this by setting the [--DEFINE LINK_TO_PAGE--] section of the "Link Template Override" template to not output anything. If you want the shopper to be able to click on the product image/name and see more details, you will then need to include something in the product layout, to either have a link to the product's moreinformation page or perhaps some other page.

Re: Search Template

PostPosted: Thu Jun 26, 2014 10:28 am
by ShopSite Lauren
What I like to do is create a page template with the DEFINE LINK_TO_PAGE as follows:
[-- DEFINE LINK_TO_PAGE --]<!-- [-- PAGE.Name --] -->[-- END_DEFINE --]
I think ShopSite has an issue if this field is blank, so I put a commented out name in it. Then define this new page template as your link template under Preferences > Search Settings > Search Layout.

Then, in my product template for the search results, I would include the 2 divs.

Then your search result template can be simplified to just be:
[-- LOOP SEARCH --]
[-- SEARCHRESULT --]
[-- VAR.pa_search_result "true" --]
[-- END_LOOP SEARCH--]



OR...

If you really want the 2 divs inside the search result template, you can do the following:
[-- LOOP SEARCH --]
[-- IF SEARCHPRODUCT --]<div class="col-md-3"><div class="pods thumbnail">[-- END_IF --]
[-- SEARCHRESULT --]
[-- IF SEARCHPRODUCT --]</div></div>[-- END_IF --]
[-- VAR.pa_search_result "true" --]
[-- END_LOOP SEARCH--]