How to get all Store Ids in Magento

$allStores = Mage::app()->getStores();
foreach ($allStores as $_eachStoreId => $val)
$_storeCode = Mage::app()->getStore($_eachStoreId)->getCode();
$_storeName = Mage::app()->getStore($_eachStoreId)->getName();
$_storeId = Mage::app()->getStore($_eachStoreId)->getId();
echo $_storeId;
echo $_storeCode;
echo $_storeName;


Change default Home page url to any page url in Magento

To change default index page of magento any cms page or any page like login page is quite easy .To do so you need to login to the admin panel then goto System -> Configuration , then click on web tab from the right side tab.Now click on Default Pages tab and change the Default web url as per your required Url.Here is one example where I have changed my Homepage url to Login page Url

Change default Home page url to any page url in Magento


How to find third highest salary from a database table by sql or mysql

By this query you can find all possible(nth) highest salary starting from 2nd to nth.Just palace your find number salary in the place of `n` and you can get result. Here I have wrote the `n`th highest salary.

Select salary
from `tablename`
order by `columnname` desc
limit n-1,1;

Write 2 instead of n-1 to find the 3rd highest salary.Write 1 instead of n-1 to find the 2nd Highest salary.

How to Count all li elements in an ul tag by javascript

<script type="text/javascript">
var ulId = document.getElementById("ulid");
var totalLi = ulId.children.length;

The list of the li in ul tag example is

<ul id="ulid">

How to get parent category Id in Magento

To get Parent Category Id you must know the current category Id, for that you need to write
$_cat = new Mage_Catalog_Block_Navigation();
$curent_cat = $_cat->getCurrentCategory();
$curent_cat_id = $curent_cat->getId();?>

Now you can get Parent Category Id.
write the code given below to get the Id
<?php $parentId=Mage::getModel('catalog/category')->load($curent_cat_id)->getParentId();
echo $parentId; // $parentId will print your current category's parent Id

How to change logo and alter logo text in Magento

There is 2 way to change logo in Magento
1) From Admin panel
2) From core file

To change logo of magento from admin panel you need to login to admin panel . Then go to System -> Configuration -> Design
Then click on Header tab to change the logo src (source ) to your respective filename or path. There also you can change logo alt (alternet) text

TO change logo from core file you need to go app/code/core/Mage/Page/config.xml. There you can change <logo_src> to your respective file name/path. There you can change logo alt text from <logo_alt> tag.