To do this, make sure that you have enabled backups in the inventory tab.
If you are on the product page, then first of all get the product number.
<?php $inventory = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product); if( (int)$inventory->getQty() == 0 && $inventory->getBackorders() ) {
You can also put this code in app\design\frontend\base\default\template\catalog\product\view\type\default.phtml , where a message about product availability appears.
source share