If you need to get your Magento project version Programmatically use below code
$m= new Mage;
$version=$m->getVersion();
echo $version;
<button onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')" class="button btn-cart" title="Add to Cart" type="button"><span><span>Add to Cart</span></span></button>
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/../app/Mage.php';
Mage::app();
$currentCategoryID=99;
function getParentTopCategory($category)
{
if($category->getLevel() == 2){
return $category;
} else {
$parentCategory = Mage::getModel('catalog/category')->load($category->getParentId());
return getParentTopCategory($parentCategory);
}
}
function Subcategory($subcats){
echo '<ul>'; foreach($subcats as $_category)
{
// $_category = Mage::getModel('catalog/category')->load($subCatId);
if($_category->getIsActive())
{
$caturl = $_category->getURL();
$catname = $_category->getName();
echo '<li>';
echo '<a href="'.$caturl.'" title="'.$catname.'">'.$catname.'</a>';
echo '</li>';
$subcats3 = $_category->getChildrenCategories();
if ($subcats3) {
Subcategory($subcats3);
}
}
}
echo '</ul>';
}
// $openCatId = getParentTopCategory(Mage::getModel('catalog/category')->load($currentCategoryID))->getId();
//OR you can use below code to get parent catgeory id of lavel 2
$path=explode('/',Mage::getModel('catalog/category')->load($currentCategoryID)->getPath());
$openCatId= $path[2];
$cat = Mage::getModel('catalog/category')->load($openCatId);
$subcats = $cat->getChildrenCategories();
if ($subcats) {
foreach($subcats as $_category)
{
if($_category->getIsActive())
{
$caturl = $_category->getURL();
$catname = $_category->getName();
echo '<a href="'.$caturl.'" title="'.$catname.'">'.$catname.'</a><br>';
$subcats2 = $_category->getChildrenCategories();
// exit;
if ($subcats2) {
Subcategory($subcats2);
}
}
}
}
?>
http://www.magentocommerce.com/boards/viewthread/283368/