Back Button On Product Detail Page In Magento

Sometime we need to place back button on item detail page in magento, to achive thhis task we need to follow steps given below

place the code given below in view.phtml

file location: “/app/design/frontend/default/default/template/catalog/product/view.phtml”
path for view.phtml can be diffrent for diffrent magento themes.

[php]
<?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;?>
[/php]
For look and feel for the button place the code given below in your style.css
[css]
.add-to-box .back-button {
padding: 180px 0 0;
}

.back-button {
float: right
padding: 8px 0 0;
}
[/css]

Leave a Comment

Your email address will not be published. Required fields are marked *

*