magento 获取当前所在的目录ID:
方法一:
$curLayer = Mage::getSingleton(‘catalog/layer’); 
$curCategory = $curLayer ->getCurrentCategory();
$curCategoryId=  $curCategory  ->getId(); 
方法二:
$curCategoryId = Mage::registry('current_category')->getId();