Created
July 31, 2013 07:40
-
-
Save brankoajzele/6120080 to your computer and use it in GitHub Desktop.
The "Go back" button for Magento. Designed so that if you landed on Magento from external site then button wont be shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (($referrer = Mage::app()->getRequest()->getServer('HTTP_REFERER'))): ?> | |
<?php $storeUrlParts = parse_url(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)); ?> | |
<?php $referrerUrlParts = parse_url($referrer); ?> | |
<?php if ($storeUrlParts['host'] === $referrerUrlParts['host']): ?> | |
<button type="button" title="<?php echo $this->__('Go back to %s', $referrer) ?>" class="button" onclick="this.innerHTML = '<?php echo $this->__('Redirecting...') ?>'; window.location = '<?php echo $referrer ?>';"><?php echo $this->__('Back') ?></button> | |
<?php endif; ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment