Custom search results page links

Questions and answers about ShopSite Custom Templates

Custom search results page links

Postby firstrunfeatures » Thu Sep 20, 2012 1:38 pm

I am working on a custom search_product template to control how search results are displayed. I have made it so that both PRODUCT.Graphic and PRODUCT.Name link to PRODUCT.MoreInfoURL (and then made the search destination on the product pages "Store" instead of "MoreInfo" so that the product links do not appear in duplicate below each search result). So far, so good. The problem I've run into is that I have a handful of products that DO NOT have MoreInfo pages and instead have custom search destination links defined on their product pages. So on the search results page I need to make my product images and names link not specifically to the MoreInfoURLs, but to whatever I have defined as each product's search destination (which in most cases *is* the MoreInfo page, but in some cases will be a custom URL). Is there a tag that defines the product search destination link that I can put into my search_product template? I know that the search_link template normally defines this, but I'm trying not to use that - just want one link to show up, in the middle of the search_product definition. If that makes any sense at all...! :? Basically I'm looking for the existence of PRODUCT.SearchDestination. Help?
firstrunfeatures
 
Posts: 4
Joined: Thu Sep 20, 2012 11:21 am

Re: Custom search results page links

Postby Jim » Thu Sep 20, 2012 2:42 pm

There is no template tag to get the value of the search destination field.

You might be able to work around this by doing something like (this is just pseudo code, I haven't actually tried it so you may have to experiment a bit.)

Code: Select all
[-- IF PRODUCT.DisplayMoreInformationPage --]
output your regular images and links like when a moreinfo page is created.
[-- Else --]
output the image and names as links to the non-moreinfo page url.
[-- end_if --]

In order to do that you will have to know or be able to figure out what the url to the non-moreinfo page will be. You could use one of the Extra product fields to hold that information. You could also base the file name of the destination of the link on the SKU or another field and then use code like <a href="[-- store.outputurl --]/[-- product.sku --].html"> as the file the link points to.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Custom search results page links

Postby firstrunfeatures » Fri Sep 21, 2012 9:21 am

Worked beautifully - THANK YOU! Also, since I'm using the SKU field now for the non-MoreInfoPage URLs (instead of the link field in the search destination section of the product page), this takes care of the duplicate links showing up on the search results page for those titles (which was a problem for those, since they didn't point to "Store" and I couldn't make them go away with the usual trick for that - and now they do point to Store and we're all set). That was going to be my next question - so yay! :D Thanks again.
firstrunfeatures
 
Posts: 4
Joined: Thu Sep 20, 2012 11:21 am


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 14 guests

cron