Getting rid of category text on search results page

General ShopSite user discussion

Getting rid of category text on search results page

Postby malljess » Sun Oct 23, 2011 8:55 am

no matter I take out from the code, on the results page the category is listed below each product. How do i get rid of it?
malljess
 
Posts: 50
Joined: Sat Oct 22, 2011 7:38 am

Re: Getting rid of category text on search results page

Postby Jim » Sun Oct 23, 2011 1:53 pm

When a search succeeds it returns two pieces of information, the product record number and a links to any page the product is found on. ( Pro level stores have a Search Destination field where the merchant can specify where the link goes. Manager stores always return a link to the page (category) that the product is found on.)
So the basic format of data returned for a search with 3 product results with he first product being found on 4 pages, the second on 1 and the third on 2 would be:
Product ID 1, product page link 1a, product page link 1b, product page link 1c, product page link 1d
Product ID 2, product page link 2
Product ID 3, product page link 3a , product page link 3 b

There is no way to turn off that information for a product. So if you don't want to see the page link you need to craft your templates it does not display. The easiest way to do that is to create a custom page template for the link ad have it be like this:

[-- DEFINE LINK_TO_PAGE --]
[-- END_DEFINE LINK_TO_PAGE --]

That way nothing will be output for the links.

However, when the code does a [-- LOOP SEARCH --] it does't return everything, product ID and links all at once. It returns each piece individually. So for the 3 products in my example above it would go trough the loop once for Product ID 1, another time for product page link 1a, another for product page link 1b etc. until all links are done. Then it moves on to the next product ID and loops twice, then on to the third product ID and loops 3 times.

All of that above paragraph comes into play when you format your output. If you open a <td> at the start of the loop and a closing </td> at the end of each time through the loop, you would 5 <td>s for the first product 2 for the second, 3 for third. That kind of output would really mess up a table. So what you need to do is format your data by checking which type of search result is being returned, product ID or link. There are special tags to help do this, [-- IF SEARCHPRODUCT --] and [-- IF SEARCHLINK --] These will indicate which type of result is being returned and you would use them like this.

[-- LOOP SEARCH --]
[-- IF SEARCHLINK --]
# we don't want to do anything
[-- END_IF --]
[-- IF SEARCHPRODUCT --]
# we want to output the product information using the template assiged.
# If you want to do some formatting around each product result start it here
[-- SEARCHRESULT --]
# and end it here.
[-- END_IF --]
[-- END_LOOP SEARCH --]
I know this has been discussed previously in the forum so you can probably find more exact code if you do a search.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 14 guests

cron