Search Template

Questions and answers about ShopSite Custom Templates

Search Template

Postby Kapitol » Wed Jun 25, 2014 12:32 pm

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.
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Search Template

Postby Jim » Wed Jun 25, 2014 1:12 pm

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.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Search Template

Postby Kapitol » Wed Jun 25, 2014 1:25 pm

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
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Search Template

Postby Jim » Wed Jun 25, 2014 3:53 pm

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.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Search Template

Postby ShopSite Lauren » Thu Jun 26, 2014 10:28 am

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


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 18 guests