Hi DW.
We have designed an option on a product list, where the user (frontend) can click to change the apperance of the productlist.
ie. List-items
ie. Picture and information.
The apperance is so radical, that I might need another template for the product list.
How can I set some variable, which interacts with the template system after a user has selected a choice on the frontend?. Is there any way to do this without writing a custom module, and if so I need a custom module, how could it be done?
Thanks :-)
Peter
Developer forum
E-mail notifications
E-com: Change template on productlist based on customer selection in frontend
Peter Bille Larsen
Posted on 17/09/2011 23:48:47
Replies
Vladimir
Posted on 19/09/2011 02:51:20
Hi Peter!
It can be implemented without custom module.
The best way to do two types of view - is switching the current CSS class(view-list <> view-block). Believe me, there are no limits on complexity for this decision.
Solution with a variable, is also posible- send in the request type of the view(myShop?viewtype=list), and in template, analyze it <!--Server: Request.viewtype-->. But this decision will not be as elegant as a first
Best regard,
vladimir
It can be implemented without custom module.
The best way to do two types of view - is switching the current CSS class(view-list <> view-block). Believe me, there are no limits on complexity for this decision.
Solution with a variable, is also posible- send in the request type of the view(myShop?viewtype=list), and in template, analyze it <!--Server: Request.viewtype-->. But this decision will not be as elegant as a first
Best regard,
vladimir
Peter Bille Larsen
Posted on 19/09/2011 09:25:34
Hi Vladimir.
Thats just awesome.
When you say switching the CSS class, you mean by making a JS cookie? or do you mean switching css within DW's template system?
thanks :-)
//Peter
Thats just awesome.
When you say switching the CSS class, you mean by making a JS cookie? or do you mean switching css within DW's template system?
thanks :-)
//Peter
Nicolai Høeg Pedersen
Posted on 19/09/2011 13:13:07
Hi Peter
If you add a viewtype parameter to the URL, inside your list template you can do something like this:
if(Server: Request.viewtype=list)
include(productlist.html)
endif
if(Server: Request.viewtype<>list)
include(mosaic.html)
endif
If you add a viewtype parameter to the URL, inside your list template you can do something like this:
if(Server: Request.viewtype=list)
include(productlist.html)
endif
if(Server: Request.viewtype<>list)
include(mosaic.html)
endif
Peter Bille Larsen
Posted on 19/09/2011 15:37:46
Great.
thanks for the help guys.
//Peter
Peter Bille Larsen
Posted on 29/09/2011 10:02:59
Hi Nicolai
I am having some problems with the default value.
I cannot get this to work: (because the viewtype is not set on the default value when you enter the productlist)
if(Server: Request.viewtype<>list)
include(mosaic.html)
endif
I have also tried:
If[Not](Server:Request.viewtype<contains>list
But this does not work either.
How do you think I could make the default value?
Nicolai Høeg Pedersen
Posted on 29/09/2011 10:31:16
Try using If Defined on Server: Request.viewtype instead.
You must be logged in to post in the forum