Magento Tips: How To Make Browsers Update And Refresh The Theme Files

February 15, 2013 Aleksander Tretjak Tips&Tricks
Magento Tips: How To Make Browsers Update And Refresh The Theme Files

Sometimes after making changes to the website design it is required that users’ browsers would update and refresh the theme files. To solve this issue it is possible to implement the versioning of static files. For instance, one can add a parameter with the theme version number.

So what we need to do is to add the parameter specifying the version number.

We have: http://test.com/js/prototype/prototype.js

It will become: http://test.com/js/prototype/prototype.js?ver=2

To do this, we need to override Mage_Page_Block_Html_Head and change the method of forming addresses of theme static files:

} else { foreach ($rows as $src) { //BelVG Start if(Mage::helper(‘staticversion’)->isEnabled()) { $src .= ‘?ver=’ . Mage::helper(‘staticversion’)->getVersion(); } //BelVG End $html .= sprintf($format, $src, $params); } } ….

Static Version

Download Static Version from GitHub



Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *