Why site is so slow on IE even to scroll – Poor IE 8,9 performance

Stop using IE

IF your site is running too slow on IE 8 or IE 9, but it is working perfectly fine on Chrome and Firefox. Check if you are using shadow filter in your css. While Internet Explorer is generally slower than Chrome and Firefox, It is not as slow as when using shadow filters. It really performs terribly that render your site useless and deter visitors from ever daring to visit your site. This is why you should never use filters again. Even scrolling becomes too slow and jumpy. Opening javascript dialog boxes such as jquery lightbox takes extra seconds that it makes the website hard to navigate. While Microsoft describe shadow filter as depreciated on MSDN for IE 9 and above. it is still inexcusable to have it perform this slow especially that IE 8 only supports that way.

The following css makes a huge performance degradation in IE :


filter: progid:DXImageTransform.Microsoft.Shadow(Color=#777777, Strength=2, Direction=0), progid:DXImageTransform.Microsoft.Shadow(Color=#777777, Strength=2, Direction=90), progid:DXImageTransform.Microsoft.Shadow(Color=#777777, Strength=2, Direction=180), progid:DXImageTransform.Microsoft.Shadow(Color=#777777, Strength=2, Direction=270);

Here is a demo of the issue, try this on IE and then on Chrome/Operate/Firefox/Safari. Try to click remove and add filters and notice the difference. Click the images to trigger lightbox and see how slow it is when the filters implemented. Even on simple text page, it is still slow when scrolling. On Chrome and Firefox, the shadow implemented using box-shadow which performs excellently.

Demo showing IE shadow filters performance

Magento: How to hide products that have no images

If you would like to hide products without images in your Magento store product list page, this is one way to do it. edit app/design/frontend/[YOUR CURRENT TEMPLATE]/[YOUR CURRENT THEME]/template/catalog/list.phtml (e.g. app/design/frontend/default/default/template/catalog/list.phtml)

Change :


$_productCollection=$this->getLoadedProductCollection();

to


$_productCollection = clone $this->getLoadedProductCollection(); $_productCollection->clear() ->addAttributeToFilter('image', array('neq' => 'no_selection')) ->load();

Since the collection we get from getLoadedProductCollection was already fetched from database, we cannot add attribute filters to it, that’s why it wouldn’t work without the clone. So we need to clone it then clear it. then add the attribute filter.

If you are not familiar with neq, neq means not equal.

Magento: How to calculate tax programmatically

This is how to calculate tax on a given price and product programmatically in Magento.


$priceInclTax=Mage::helper('tax')->getPrice($product,$price);

You can get $price from $product using


$price=$product->getFinalPrice();

You can get price the way you want, it can be custom price or any number you want to calculate tax on, but you need to pass the $product which should be a valid product object.

How to view wikipedia on SOPA blackout day

On Wednesday wikipedia English is blacked out in protest of proposed anti-piracy law SOPA in US congress. you are greeted with blacked out page with information about SOPA. However you don’t have to postpone your research or daily wikipedia reading. You can still view wikipedia site despite the blackout, by simple javascript code bookmarlet that can show all hidden elements on page.

So how to show hidden element on page using Javascript?


var tags=document.getElementsByTagName("*"); //get all tags for (var tg in tags){ try{ if (tags[tg].style.display=="none")tags[tg].style.display="block"; //check if they are hidden, display if they are }catch(e){ } }

Or you can copy the same code as bookmarklet to your browser bookmark bar. simply drag the link/button below and drop it on your browser’s bookmark bar or favorites. when on wikipedia on SOPA day or a page that you need to show all hidden elements , click Show all hidden elements.

Show all hidden elements