I have developed a module to make a custom menu to show thumpnail images of sub categories when hover the main menu or category.

For that in the Block of my module, I return the src of each thumpnail images using the following.

return Mage::getBaseUrl('media').$thumnail

As it returns the url scheme as http always, checkout page is not completely secure. So I changed it to return secure url as below

return Mage::getBaseUrl('media',true).$thumnail 

Then it returns always https in it's url scheme.

I want https, only for checkout page since it needs to be secure, and http for other pages. How to solve it?


Just change Mage::getBaseUrl('media',true); to


  • Thanks for the reply! It returns url scheme always as 'https'. – SIBHI S Sep 23 '14 at 5:05
  • I want https, only for checkout page, not for other pages. Your solution returns https for all pages (As Mage::getBaseUrl('media',true) doing) – SIBHI S Sep 23 '14 at 6:10

Either not passing the second parameter or passing it as null should work here for you. When it builds the url if the secure parameter is null then if checks if you are currently on a secure page.

$secure = is_null($secure) ? $this->isCurrentlySecure() : (bool)$secure;

This then goes off and checks if you are requesting the page from http or https. Once this has been returned Magento then loads the url from the config from either the secure or unsecure node.

$url = $this->getConfig('web/' . ($secure ? 'secure' : 'unsecure') . '/base_url');

If you step through the functions you should be able to find the error but the function call should be return Mage::getBaseUrl('media').$thumnail

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.