Magento has three different codepools:
This core pool folder stores all the code that makes Magento so powerful, flexible and lovely. The chief rule of Magento development is that you should never make any changes in the core pool.
This folder belongs entirely to community developers. This is the right place for hundreds of 3rd party extensions, both free and paid, that can be found at MagentoConnect. So basically, if you have installed any extension, it must be in app/code/community/ only.
If you have your own Magento-based store and want to make everything by yourself or you are a Magento developer and have a purpose to change the logic somehow, local pool is the place where everything should be done. If you want to override Magento extensions, blocks or methods, copy the necessary folders from the Core pool and do whatever you are inclined to do. Apply the same rule for custom extensions that are created specifically for the website – all code should be in local pool.
How does the framework interact with the various codepools?
To identify the proccess let’s take a look at app/Mage.php
* Set include path
$paths = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘local’;
$paths = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘community’;
$paths = BP . DS . ‘app’ . DS . ‘code’ . DS . ‘core’;
$paths = BP . DS . ‘lib’;
$appPath = implode(PS, $paths);
set_include_path($appPath . PS . Mage::registry(‘original_include_path’));
This code snippet illustrates the order Magento is using to include paths – firstly it includes Local code pool, than community and after that – core, which allow developers to override classes without changing core files.
I have come to many situation to call static block from CMS Pages, and i am using the below code to do this trick. You can use this code to call a static block on any of your CMS page like homepage so you just follow the steps
Go To CMS->Pages
Select Your page
Go To Design->Layout Update XML
Reference means the block will call on left right or Content
In case if reference already there then just use
Here is the tip for you to check for homepage in Magento. I had come across a situation to add a banner block conditionally on the homepage. The below code helps me to accomplish the same. Hope this will help you too.
Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms'
If you need to display a custom menu based on your categories, subcategories in magento, you can use the below code for the same.
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
<?php foreach($_categories as $_category): ?>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
<?php echo $_category->getName() ?>
<?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
<?php $_subcategories = $_category->getChildrenCategories() ?>
<?php if (count($_subcategories) > 0): ?>
<?php foreach($_subcategories as $_subcategory): ?>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<?php echo $_subcategory->getName() ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
If you are facing an error ‘The directory is not writable by server’ in magento please ensure the following :
First of all Check if the server has the write permission on var and media folders. This might solve the issue. If still the issue persists go through the following steps:
check whether the ‘media/catalog’, ‘media/wysiwyg’ and ‘media/images’ are there in the media folder. If it doesn’t exists create the folders, and give write permisission for those folders.
Hope this will resolve your issue.
Well,before we starting to go with theme development we need to understand the Magento Hierarchy and where our theme falls into place. There are hundreds of folders and thousands of files, so the listing of all items will be impossible, I will only be focusing on the ones we need to work with.
Within a sub-folder of app and skin are where our packages and themes can be found, a typical install of Magento comes with two packages base and default.
Next we can learn about packages.