We would like to add a link "view all other [category name] products" on the product page.
We tried several things no full success.
- it seems there is a last viewed category methode
Mage::getSingleton('catalog/session')->getLastViewedCategoryId()
but this is always empty - and
Mage::registry('current_category')
is also empty - so we added a method to capture the breadcrumbs and get the before last item (this seems to work in some cases, but when the user opens some items directly or some Magento systems show the shortest path: then it results in "view all"
We are now testing a work around where we use setData to the session to store the category name and url whilst visting the category. We retrieve this on the product page. This seems to work in some cases also - but we use a FPC - so this code is not always executed.
What is the best - and always working - method to get the last visited category?
thanks in advance