function getCurrentCmsPage()
    $pageId = Mage::getBlockSingleton('cms/page')->getPage()->getIdentifier();
    return $pageId;


2.How to filtrate Magento category collection by rank?

Sometimes you need to get a list of all categories with a particular level for a custom navigation menu. This can be done as follows:

$model = Mage::getModel('catalog/category');
$categories = $model->getCollection()

However, this is not always correct. I think I should explain why, right?

If I will enter request to a base I will get the following:

SELECT `main_table`.* FROM `catalog_category_flat_store_1` AS `main_table` WHERE (main_table.level <= 2) AND (is_active = '1')

It is very obvious that condition <= is in use, which doesn't fit, because filtering categories of 3 rd level we will also get categories with the 2nd level.

Due to this we should filter in the following way:

$categories = $model->getCollection()
    ->addAttributeToFilter('level', 2)

After this we can do whatever we want with the collection.

3. 404 error appears when entering Magento admin panel.

Sometimes migration to the other server can cause some problems such as error 404. The most frequent reason is a hosting switching. And if you want to fix it, first of all you have to commit the next query:

UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGEDIN';

Next, clear your cache folder in var/cache/. If you own enterprise version or FPC has been installed - then folder /var/full_page_cache/ needs to be cleared as well. I would also recommend you to test and improve speed of your Magento store permanently - that would be a good practice as well.