Lemonstand back to search or category results

December 6, 2012    lemonstand lemonstand back button lemonstand back to search lemonstand search results

Today I had to add a basic back to search results implementation and thought i'd blog it for future reference.

I could not find anything implemented in the documentation so decided to add this snippet of code to any of the category or search pages that I had. Be sure to add it inside of the partial which gets re-loaded during pagination changes to continuously update the session as the user browses.

set('back_r', $_SERVER['REQUEST_URI']); ?>

You can imagine whats next, open your product page / product partial (depending on your setup) and add the following lines where you would like to display the back to search results link.

$back_r = Phpr::$session->get('back_r');
if($back_r)
{
    echo '« back';
}

Hopefully this might be of use to someone else.


blog comments powered by Disqus