Magento: How to enable maintenance mode?

Maintenance mode is a key feature required to any website. You need to set the live website into maintenance mode whenever you need to do any changes in the website. Here, I will show how you can do this in Magento. For Magento version 1.4 and above, you just need to create a file named … Read more

Magento: How to check if current page is homepage?

Here is a quick Magento code to check if the current page is homepage or not. If you are in template/page/html/header.phtml template file, then you can check for homepage with the following code: if($this->getIsHomePage()) { echo 'You are in Homepage!'; } else { echo 'You are NOT in Homepage!'; } If you are elsewhere (in … Read more

Magento: Join, filter, select and sort attributes, fields and tables

In my previous article (Magento: Very Useful Collection Functions), I had written about database interaction functions present in class Varien_Data_Collection_Db. Here, I am going to explain some database interaction functions present in the class Mage_Eav_Model_Entity_Collection_Abstract. These collection functions are very useful to select data from Magento database. We need them almost all the time for … Read more

Magento: Convert Price from Current Currency to Base Currency and vice-versa

Here is a quick code to convert price amount from current currency of the shop to base currency. This is applicable when you have a multiple currency shop. From the code below, you can convert any currency you desire. You just need the ‘From Currency Code’ and ‘To Currency Code’. In the example below, I … Read more

Magento: Get list of all Categories

Here, I will show you how you can get list of all categories of your Magento Shop. You might want to display all categories in homepage or any CMS page. There are different ways to get the category listing. Here are some:- Get all categories The following code will fetch all categories (both active and … Read more

Magento: How to change default page layout?

Here, I will show you how you can change the default page layout in Magento. By page layout, I mean all CMS page, category page, etc. There are different ways to change the page layout in Magento. Here are some of them:- Changing individual category page layout You can modify the page layout of each … Read more

Magento: How to get list of all modules programmatically?

Here, I will show you how you can get list of all modules in your Magento installation. It’s a simple code. Get all modules You can find getNode() function in the class Mage_Core_Model_Config. $modules = Mage::getConfig()->getNode('modules')->children(); From the code above, you get all the modules information like whether the module is active or not, the … Read more

Magento: How to change the ‘Default welcome msg!’

Here is a quick tip to change the Default welcome message that appears in header of Magento shop. When the user is not logged in, the message appears as ‘Default welcome msg!‘. To change the message text, follow steps below:- – Go to System -> Configuration -> GENERAL -> Design -> Header -> Welcome Text … Read more

Magento: Showing Store Selector / Switcher in header and footer

Here, I will show you how to show the store selector (store switcher) in header. By default, the store selector is present in footer. Create a new phtml file (template/page/switch/stores-top.phtml) and write the following code in it :- <?php if(count($this->getGroups())>1): ?> <div class="language-switcher" style="margin-left:15px"> <label for="select-store"><?php echo $this->__('Select Store') ?>: </label> <select id="select-store" onchange="location.href=this.value"> <?php … Read more