Thursday, August 29, 2013

Magento shortcuts

Various magento shortcuts

Get a url with the correct protocol (http/https)

To get a url from a template with the correct protocol use:
$url = $this->getUrl('some url path', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure()));

Alternatively you can use:
$this->getUrl('some url path', array('_secure' => Mage::app()->getStore()->isCurrentlySecure()));

If you are outside a template you can replace $this-> with Mage::

No comments:

Post a Comment