Developer forum

Forum » Development » Search result width different templates?

Search result width different templates?


Reply
Is it possible to control, which product template to use from the link in the search result?

In this case, I have two different groups of products, and they can't use the same product template (I have tried to build a common template with if/else combinations, but haven't succeeded...)

Example: If you search an "armatur" - nr. 4325 - the product should be linked with PID=80, and anything else but armatures should be linked width PID-10.

But I can't figure out how to differentiate between them. And maybe there's another and smarter way to do it?

Help?

Kind regards, Lise

Replies

 
Reply
 I assume that you are using ecom search and not the general search module and that 4325 is a group number, right?

Your search template (productlist) could look like this...

<ul>
<!--@LoopStart(Products)-->
    <li><a href="<!--@Ecom:Product.Link.Clean--><!--@LoopStart(ProductGroups)-->&G<!--@Ecom:Group.Number-->=1<!--@LoopEnd(ProductGroups)-->"><!--@Ecom:Product.Name--></a></li>
<!--@LoopEnd(Products)-->
</ul>

...and your product template like this...

<div>
<!--@If Defined(Server:Request.g4325)-->
<p>Alternative display of <!--@Ecom:Product.Name--></p>
<!--@EndIf(Server:Request.g4325)-->
 
<!--@If Not Defined(Server:Request.g4325)-->
<p>Default display of <!--@Ecom:Product.Name--></p>
<!--@EndIf(Server:Request.g4325)-->
</div>

I have NOT tested this, but maybe it works :)

 

You must be logged in to post in the forum