<?php
$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;
}
?>
Magento Tutorial, Magneto modules, Magento Banckend, Magento admin, Magento Frontend, Magento Interview Question, Jquery, CSS, Javascript, PHP, XHTML
8/30/2010
How to get all Store Ids in Magento
8/28/2010
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
8/26/2010
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;
alert(totalLi);
</script>
The list of the li in ul tag example is
<ul id="ulid">
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
- Item1
- Item2
- Item3
- Item4
How to get parent category Id in Magento
<?php
$_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
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.