I am trying to write a simple script to hide the "checkout" button located on the sidebar mini cart in Magento if on the checkout page. For obvious reasons I don't think the checkout button should still be visible if the customer is already on the checkout page...
Here is what I have done but Its not working and I am not sure how far off I am.
<?php if(Mage::getURL('checkout/onepage') == Mage::helper('core/url')->getCurrentUrl()): ?>
<?php echo $this->__('Checking out...') ?>
<?php else: ?>
<button type="button" title="<?php echo $this->__('Checkout') ?>" class="btn btn-mini btn-success" onclick="setLocation('<?php echo $this->getCheckoutUrl() ?>')"><span><span><?php echo $this->__('Checkout') ?></span></span></button>
<?php endif ?>
If someone could be kind enough to give me a shift in the right direction I'd be grateful OR even let me know of a better method...
try this:
Mage::getURL('checkout/onepage') // or $this->getUrl('checkout/onepage')
This will get the url for the checkout/onepage route
Mage::helper('core/url')->getCurrentUrl()
this will get you the current url
Now compare them:
<?php if(Mage::getURL('checkout/onepage') == Mage::helper('core/url')->getCurrentUrl()) ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With