I am using below code to show back button on product details page after search results but the back button doesn't show if I go the details page after search results. I am now checking using $_product->getCategory()
but i need some condition to show back button after search result as well.
<?php if ($_category = $_product->getCategory()): ?>
<div class="back-button">
<button onclick="history.back();" class="button" title="<?php echo $this->__('Back') ?>" type="button">
<span>
<span><?php echo $this->__('Back') ?></span>
</span>
</button>
</div>
<?php endif;?>
I want to show back button on product details page when someone click product details page from search results.