Search Template help

General ShopSite user discussion

Search Template help

Postby NuQ » Thu May 12, 2005 9:31 am

Trying to get the search results to be displayed in columns. Here is the
search template that was created when the site was first set up a few years
ago. I'm looking at the search tags and have tried all of the Loop Search
tags to no avail. Thanks for any advice.

#
# Search Results define
#
[-- DEFINE SEARCH_RESULTS --]
<html>
<head>
<title>[--Store.SearchResults --]: [-- SearchString --]</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body
[-- PAGE.COLUMNS 3 --]
[-- IF PAGE.BACKGROUNDIMAGE --]
background=[-- PAGE.BACKGROUNDIMAGE --]
[-- END_IF --]
bgcolor="[-- PAGE.BACKGROUNDCOLOR --]" text="[-- PAGE.TEXTCOLOR --]"
link="[-- PAGE.LINKCOLOR --]" vlink="[-- PAGE.VISITEDLINKCOLOR --]"
alink="[-- PAGE.ACTIVELINKCOLOR --]" >

[-- IF PAGE.DISPLAYPAGEHEADER --]
[-- HEADER --]
[-- END_IF --]
[-- IF PAGE.DISPLAYGRAPHIC --]
<center>[--PAGE.GRAPHIC --]</center>
[-- END_IF --]
[-- IF PAGE.DISPLAYNAME --]
<center> <h1> [--PAGE.NAME --] </h1> </center>
[-- END_IF --]
#Search form at top of page

<h3>[--Store.SearchResults --]: [-- SearchString --]</h3>
<hr>

[-- IF PAGE.TEXT1 --]
<br>[-- PAGE.TEXT1 --]<br>
[-- END_IF --]
# set layout variable - save time looking up value repeatedly from the
database

[-- VAR.LAYOUT PAGE.LAYOUT --]

#Start of the loop to output the search results - Products with associated
Links
<b>[--Store.SearchResultPage --]:</b><br>
[-- IF SEARCHTOP --]
[-- SEARCHRESULT_FORM --]
</center>
[-- END_IF --]

[-- LOOP SEARCH Page.Columns--]
<div align="left">
<table width="95%" border="0" cellspacing="3" cellpadding="3">
<tr>
<th scope="col"><div align="left">

[-- SEARCHRESULT --]

</tr>
</table>
</div>

[-- END_LOOP SEARCH --]



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

#Search form at bottom of page
[-- IF SEARCHBOTTOM --]
[-- SEARCHRESULT_FORM --]
</center>
[-- END_IF --]

[-- IF PAGE.TEXT2 --]
<br>[--PAGE.TEXT2 --]<br>
[-- END_IF --]
[-- IF PAGE.DISPLAYPAGEFOOTER --]
[-- FOOTER --]
[-- END_IF --]
[-- IF PAGE.TEXT3 --]
[-- PAGE.TEXT3 --]
[-- END_IF --]
</body>
</html>
[-- END_DEFINE SEARCH_RESULTS --]
NuQ
 

Re: Search Template help

Postby Jim » Fri May 13, 2005 8:13 am

Although it is possible to create a search results page with multiple
columns it is not as easy to do as on a normal page. It will require
special templates for the page and the products and possibly the link
also. If the store is using subproducts (cross-sell items) it
complicates things even more since when a subproduct is displayed
usually the parent product and all subproduct for that parent are
displayed. Since search results may be spread over several pages this
also complicates the automatic table row and column generation since the
table may be split across several pages.

When search results are returned there are several kinds of items
returned; products, subproduct and links to pages. A product may have
multiple page links associated with it (since a product can be on
multiple pages). A product may have associated subproducts
(Cross-sell)items associated with it that would need to be either listed
with the product in the search result or perhaps ignored.

There are template tags to determine if the result returned by search is
a link or a product [-- IF SEARCHLINK --] and [-- IF SEARCHPRODUCT --]
respectively. The tag [-- SEARCHRESULT --] displays either the product
or the link, depending on which was returned. So your code needs to
determine if a link or a product is being returned and needs to handle
each case differently.

Another consideration is where the search result link is pointing. This
is set for each product in the Search Destination field. If the link is
to a store page then it uses is defined in the default search link
template or the one specified in the Link Template Override: field under
Search Page Layout. However if the link is to a moreinfo page the
products moreinfo link is used and the search link template is ignored.


I know I have worked on a multi column search template but can't find it
right now. (It may have been on a server that crashed recently) So I
don't have any exact code.

Here is an outline of what happens when a [-- LOOP YYYY # --] (where
YYYY could be search, products, links, subproducts, etc. and # is a
number or VAR for a number) is encountered.
ShopSite counts the number of times the loop is executed and after # is
reached it puts out a </tr> to close off that row of the table. If the
loop is entered again a <tr> is output to open the next row of the
table. ShopSite assumes that you will start and end the table outside
of the LOOP as illustrated from this bit of code from a page template.
Anything inside of the LOOP - End_LOOP will be repeated each time the
LOOP is executed.

<table class="Products" width="100%" align="center"
border="[-- VAR.border --]" cellpadding="3">
[-- LOOP PRODUCTS PAGE.Columns --]
<td valign="top" align="[-- VAR.align --]">[-- PRODUCT --]</td>
[-- END_LOOP PRODUCTS --]
</table>


As mentioned above the problem with search is that you have 2 different
types of items being returned so when the number of times the loop has
been executed to see when to output the <TR> tags you don't know if they
were products or links. So you may end up with a row of the table with
a product, a link , a link
a link, a product, a link
product, a link, product

when what you really want is
product and link(s), product and links, product and links
product and link(s), product and links, product and links
product and link(s), product and links, product and links

I hope this info is helpful. Again it is possible to do but not easy
and takes quite a bit of planning.
Sorry I don't have exact code to help you out.


Jim
PS in your template below [-- PAGE.COLUMNS 3 --] is invalid. The
Page.column value comes from the database and cannot be set by simply
adding a number after it.


NuQ wrote:
Trying to get the search results to be displayed in columns. Here is the
search template that was created when the site was first set up a few years
ago. I'm looking at the search tags and have tried all of the Loop Search
tags to no avail. Thanks for any advice.

#
# Search Results define
#
[-- DEFINE SEARCH_RESULTS --]
html
head
title>[--Store.SearchResults --]: [-- SearchString --]</title
meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"
/head
body
[-- PAGE.COLUMNS 3 --]
[-- IF PAGE.BACKGROUNDIMAGE --]
background=[-- PAGE.BACKGROUNDIMAGE --]
[-- END_IF --]
bgcolor="[-- PAGE.BACKGROUNDCOLOR --]" text="[-- PAGE.TEXTCOLOR --]"
link="[-- PAGE.LINKCOLOR --]" vlink="[-- PAGE.VISITEDLINKCOLOR --]"
alink="[-- PAGE.ACTIVELINKCOLOR --]"

[-- IF PAGE.DISPLAYPAGEHEADER --]
[-- HEADER --]
[-- END_IF --]
[-- IF PAGE.DISPLAYGRAPHIC --]
center>[--PAGE.GRAPHIC --]</center
[-- END_IF --]
[-- IF PAGE.DISPLAYNAME --]
center> <h1> [--PAGE.NAME --] </h1> </center
[-- END_IF --]
#Search form at top of page

h3>[--Store.SearchResults --]: [-- SearchString --]</h3
hr

[-- IF PAGE.TEXT1 --]
br>[-- PAGE.TEXT1 --]<br
[-- END_IF --]
# set layout variable - save time looking up value repeatedly from the
database

[-- VAR.LAYOUT PAGE.LAYOUT --]

#Start of the loop to output the search results - Products with associated
Links
b>[--Store.SearchResultPage --]:</b><br
[-- IF SEARCHTOP --]
[-- SEARCHRESULT_FORM --]
/center
[-- END_IF --]

[-- LOOP SEARCH Page.Columns--]
div align="left"
table width="95%" border="0" cellspacing="3" cellpadding="3"
tr
th scope="col"><div align="left"

[-- SEARCHRESULT --]

/tr
/table
/div

[-- END_LOOP SEARCH --]



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

#Search form at bottom of page
[-- IF SEARCHBOTTOM --]
[-- SEARCHRESULT_FORM --]
/center
[-- END_IF --]

[-- IF PAGE.TEXT2 --]
br>[--PAGE.TEXT2 --]<br
[-- END_IF --]
[-- IF PAGE.DISPLAYPAGEFOOTER --]
[-- FOOTER --]
[-- END_IF --]
[-- IF PAGE.TEXT3 --]
[-- PAGE.TEXT3 --]
[-- END_IF --]
/body
/html
[-- END_DEFINE SEARCH_RESULTS --]

Jim
 

Re: Search Template help

Postby NuQ » Fri May 13, 2005 9:07 am

Thanks so much for the detailed reply. I may have to get someone to do this
for me (unless you can find that code you had - hint, hint) ;-) Thanks
either way :-)

"Jim" <jstavast@xmission.com> wrote in message
news:d62g7g$e1d$1@eval.shopsite.com...
Although it is possible to create a search results page with multiple
columns it is not as easy to do as on a normal page. It will require
special templates for the page and the products and possibly the link
also. If the store is using subproducts (cross-sell items) it complicates
things even more since when a subproduct is displayed usually the parent
product and all subproduct for that parent are displayed. Since search
results may be spread over several pages this also complicates the
automatic table row and column generation since the table may be split
across several pages.

When search results are returned there are several kinds of items
returned; products, subproduct and links to pages. A product may have
multiple page links associated with it (since a product can be on multiple
pages). A product may have associated subproducts (Cross-sell)items
associated with it that would need to be either listed with the product in
the search result or perhaps ignored.

There are template tags to determine if the result returned by search is a
link or a product [-- IF SEARCHLINK --] and [-- IF SEARCHPRODUCT --]
respectively. The tag [-- SEARCHRESULT --] displays either the product
or the link, depending on which was returned. So your code needs to
determine if a link or a product is being returned and needs to handle
each case differently.

Another consideration is where the search result link is pointing. This
is set for each product in the Search Destination field. If the link is
to a store page then it uses is defined in the default search link
template or the one specified in the Link Template Override: field under
Search Page Layout. However if the link is to a moreinfo page the
products moreinfo link is used and the search link template is ignored.


I know I have worked on a multi column search template but can't find it
right now. (It may have been on a server that crashed recently) So I
don't have any exact code.

Here is an outline of what happens when a [-- LOOP YYYY # --] (where YYYY
could be search, products, links, subproducts, etc. and # is a number or
VAR for a number) is encountered.
ShopSite counts the number of times the loop is executed and after # is
reached it puts out a </tr> to close off that row of the table. If the
loop is entered again a <tr> is output to open the next row of the table.
ShopSite assumes that you will start and end the table outside of the LOOP
as illustrated from this bit of code from a page template. Anything inside
of the LOOP - End_LOOP will be repeated each time the LOOP is executed.

table class="Products" width="100%" align="center"
border="[-- VAR.border --]" cellpadding="3"
[-- LOOP PRODUCTS PAGE.Columns --]
td valign="top" align="[-- VAR.align --]">[-- PRODUCT --]</td
[-- END_LOOP PRODUCTS --]
/table


As mentioned above the problem with search is that you have 2 different
types of items being returned so when the number of times the loop has
been executed to see when to output the <TR> tags you don't know if they
were products or links. So you may end up with a row of the table with
a product, a link , a link
a link, a product, a link
product, a link, product

when what you really want is
product and link(s), product and links, product and links
product and link(s), product and links, product and links
product and link(s), product and links, product and links

I hope this info is helpful. Again it is possible to do but not easy and
takes quite a bit of planning.
Sorry I don't have exact code to help you out.


Jim
PS in your template below [-- PAGE.COLUMNS 3 --] is invalid. The
Page.column value comes from the database and cannot be set by simply
adding a number after it.


NuQ wrote:
Trying to get the search results to be displayed in columns. Here is the
search template that was created when the site was first set up a few
years ago. I'm looking at the search tags and have tried all of the Loop
Search tags to no avail. Thanks for any advice.

#
# Search Results define
#
[-- DEFINE SEARCH_RESULTS --]
html
head
title>[--Store.SearchResults --]: [-- SearchString --]</title
meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"
/head
body
[-- PAGE.COLUMNS 3 --]
[-- IF PAGE.BACKGROUNDIMAGE --]
background=[-- PAGE.BACKGROUNDIMAGE --]
[-- END_IF --]
bgcolor="[-- PAGE.BACKGROUNDCOLOR --]" text="[-- PAGE.TEXTCOLOR --]"
link="[-- PAGE.LINKCOLOR --]" vlink="[-- PAGE.VISITEDLINKCOLOR --]"
alink="[-- PAGE.ACTIVELINKCOLOR --]"

[-- IF PAGE.DISPLAYPAGEHEADER --]
[-- HEADER --]
[-- END_IF --]
[-- IF PAGE.DISPLAYGRAPHIC --]
center>[--PAGE.GRAPHIC --]</center
[-- END_IF --]
[-- IF PAGE.DISPLAYNAME --]
center> <h1> [--PAGE.NAME --] </h1> </center
[-- END_IF --]
#Search form at top of page

h3>[--Store.SearchResults --]: [-- SearchString --]</h3
hr

[-- IF PAGE.TEXT1 --]
br>[-- PAGE.TEXT1 --]<br
[-- END_IF --]
# set layout variable - save time looking up value repeatedly from the
database

[-- VAR.LAYOUT PAGE.LAYOUT --]

#Start of the loop to output the search results - Products with
associated Links
b>[--Store.SearchResultPage --]:</b><br
[-- IF SEARCHTOP --]
[-- SEARCHRESULT_FORM --]
/center
[-- END_IF --]

[-- LOOP SEARCH Page.Columns--]
div align="left"
table width="95%" border="0" cellspacing="3" cellpadding="3"
tr
th scope="col"><div align="left"

[-- SEARCHRESULT --]

/tr
/table
/div

[-- END_LOOP SEARCH --]



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

#Search form at bottom of page
[-- IF SEARCHBOTTOM --]
[-- SEARCHRESULT_FORM --]
/center
[-- END_IF --]

[-- IF PAGE.TEXT2 --]
br>[--PAGE.TEXT2 --]<br
[-- END_IF --]
[-- IF PAGE.DISPLAYPAGEFOOTER --]
[-- FOOTER --]
[-- END_IF --]
[-- IF PAGE.TEXT3 --]
[-- PAGE.TEXT3 --]
[-- END_IF --]
/body
/html
[-- END_DEFINE SEARCH_RESULTS --]
NuQ
 


Return to User Forum

Who is online

Users browsing this forum: No registered users and 30 guests