INSYNC New Logo

How to Show Image in Magento using Secured Server on IE Browser?


One of the greatest features of Magento is its advanced cache system, in order to view templates content faster, which can give good hiccups if not maintained properly.In this blog article you will learn how to show image in magento using Secured Server.

For any website using non-secured (HTTP) URI, no browser will normally affect displaying of images. But when you will switch from an HTTP page to an HTTPS page, using Internet Explorer browser, images will not show in that secured page, by default. The main reasons are:-

  1. The images are still having a non-secured (HTTP) URI.
  2. The “Internet Explorer” browser, by default, does not display any unsecured content on a secured page.
  3. The Block (having the images with a non-secured HTTP URI) is using the cache system, although this cache is not regenerated when you switch from an HTTP to an HTTPS page.

Due to the above reasons, a security warning is displayed when some images have HTTP URI on a HTTPS page:-

 

image in magento

 

For fixing this problem, you must rewrite the “getCacheKey()” method from “Mage_Catalog_Block_Navigation” class. A new parameter telling, if page is using HTTP / HTTPS, should be included in cache key. Cache will then be different for these 2 types of pages. This parameter is added with “getSkinUrl()” method.

Default code of the “getCacheKey()” method is:-


public function getCacheKey()

{

    return ‘CATALOG_NAVIGATION_’ . Mage::app()->getStore()->getId()

        . ‘_’ . Mage::getDesign()->getPackageName()

        . ‘_’ . Mage::getDesign()->getTheme(‘template’)

        . ‘_’ . Mage::getSingleton(‘customer/session’)->getCustomerGroupId()

        . ‘_’ . md5($this->getTemplate() . $this->getCurrenCategoryKey());

}

which is replaced by the following code:-

public function getCacheKey()

{

return ‘CATALOG_NAVIGATION_’ . Mage::app()->getStore()->getId()

. ‘_’ . Mage::getDesign()->getPackageName()

. ‘_’ . Mage::getDesign()->getTheme(‘template’)

. ‘_’ . Mage::getSingleton(‘customer/session’)->getCustomerGroupId()

. ‘_’ . md5($this->getTemplate() . $this->getCurrenCategoryKey())

. ‘_’ . md5($this->getSkinUrl());

}
 
This is it. You can now peacefully use HTTPS page of Magento on Internet Explorer, for viewing images in any block.

Now you are done going though this article.Hope this article will surely fix your problem of displaying images in Magento.If you find this piece of information useful, then pls share it.

Search

Search
On Key

Related Posts

APPSeCONNECT is now a completely new entity headquartered in the US! 🇺🇸