I would like to make a "go back to search result" in the product template, used for search - and I am using the eCom search. Is there a special tag for this?
(I found one for ordinary search module) or could I please get some hints for writing it myself?
/Lise
Developer forum
E-mail notifications
Back to search result
Posted on 06/12/2010 16:25:46
Replies
Nicolai Høeg Pedersen
Posted on 06/12/2010 16:44:31
history.go(-1) would be the best...
Posted on 06/12/2010 18:33:28
Sometimes it's too easy! I was thinking about a lot of loooong server.request codes and that sort of stuff - but I think i'll try yours ;-)
/Lise
/Lise
Jacob Bertelsen
Posted on 29/10/2012 10:49:54
Any thoughts on a Server.Request.PreviousUrl-tag, or something like that?
If a user likes to ctrl+click links, the javascript-method will not work, since it will only open a new window with
javascript:history.go(-1);
in the query string.
Jacob Bertelsen
Posted on 29/10/2012 11:01:09
Never mind. I will submit this as a feature request
Mikkel Ricky
Posted on 30/10/2012 09:45:44
Using document.referrer might be a better way to go
<div>
<a id="back-to-search">Back to search</a>
<script>(function() {
var referrer = document.referrer,
el = document.getElementById('back-to-search');
if (referrer && el && referrer.indexOf('eComQuery') > -1) {
// The referrer is (probably) a search url
el.href = referrer;
} else {
el.parentNode.removeChild(el);
}
}());</script>
</div>
Jacob Bertelsen
Posted on 07/11/2012 10:16:13
Feature request case number is
93308
You must be logged in to post in the forum