Https + Magento cache + Internet Explorer = No picture

Magento default to an extended cache system to display content templates faster. But standard configuration of this cache can eventually create some problems.

Recently we had a few pictures that were not shown in the top menu bar, if we change from a HTTP page to an HTTPS page to the Internet Explorer browser. Images in this menu is not yet secured (http) URI. Internet Explorer is not satisfied with the content. By default, this browser does not appear, unsecured secure content on a page.

We see this security warning when some image HTTP URI to an HTTPS page:

security warning

Block angezeigte Hauptmenü Verwaltungsgemeinschaft Würde mit Cache-System, ABER of this Cache regeneriert Verwaltungsgemeinschaft Würde Nicht, Wenn Wir von Einem HTTP-Umstellung Auf Eine HTTPS-Seite. Deshalb wurden Bilder NOCH Unter http URI.Zur Befestigung of this Problem MÜSSEN Wir umschreiben getCacheKey Methode aus Mage_Catalog_Block_Navigation Klasse. Ein neuer Parameter zu Sagen, fällt sterben Seite benutzen HTTP-Oder HTTPS-Cache sollte in Key einbezogen Werden. Cache WIRD Dann Anders seins für This types von 2 Seiten. Of this Parameter ist mit getSkinUrl Methode Hut

Default Code getCacheKey

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());
}

is then replaced by 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()); /*** FIX IN THIS  LINE ***/
}

This is it. You can now use peacefully https on Internet Explorer.

(Based on baobaz Turtorial)

Comments Closed