Magento E-commerce Platform Q/ A

Ways to Enable or Add Custom Breadcrumbs in Magento

There are some pages in Magento with no breadcrumbs enabled by default. In order to enable it, for example, on the checkout page, open checkout.xml file stored in 'layout' folder of the current theme, and find there 'checkout_onepage_index' block.  Then add to the block this code:

How to Automatically Convert Simple Products to Bundle in Magento

The feature might be useful for the stores dealing with large and often updated inventory. In order not to convert each product manually after each inventory update to existing bundle products it is possible to make the process automated.

First we will create the observer that will be performing the function each time a new product is saved.

Announce the observer in config.xml file:

How to Add a Custom Footer to Email Templates in Magento

Here's the example of the footer and how to do it:

247

Namespace - Ikantam

Module - EmailFooter

In the example the footer text is extracted from a readymade template. Since templates might be both text and html, the appropriate footer should be applied to each, i.e. for the html templates – html footer template, for the text templates – text footer template. How to create custom email templates you can read here

 

Creating Recursive Menu in Magento

In order to create the menu a function need to be added. The function that will receive the ID of the parent (main) categories as an argument and will be displaying child categories. Also the function should check presence of the sub-categories each time a child category is called.  

Here's the example of the 'recursive' function:

Custom Redirect from a Category Page in Magento

Let's assume your customer needs to redirect store users when they click on some category link to some particular product page. You can do it by creating a simple module. 

The structure of the etc/config.xml file:

How to Add a New Tab to a Category in Magento

To add a new magento category tab (manage categories page/ admin area), rewrite or simply copy the file from: core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php to: local/Mage/Adminhtml/Block/Catalog/Category/Tabs.php.

Next in _prepareLayout method after this code:

$this->addTab(’products’, array( 
‘label’ => Mage::helper(’catalog’)->__(’Category Products’), 
‘content’ => $this->getLayout()->createBlock(’adminhtml/catalog_category_tab_product’, ‘category.product.grid’)->toHtml(), 
));

 

Add this one:

How to Remove ‘Shipping Method’ Step from One Page Checkout in Magento

Some stores have only one shipping method and it is free so there’s no need to have this step at a checkout. The things you’ll need to do in order to hide this step: 1st set shipping methods settings to free shipping in admin area; 2nd you will need to overwrite block ‘onepage’ and create ‘onepage’ controller. Here’s the example:

 

How to overwrite 'onepage' block:

Add this code below into config.xml file (with this code we will overwrite standard magento block Mage_Checkout_Block_Onepage to Ikantam_Remove_Block_Onepage block):

Magento Source Model

Source model serves to insert the data into the certain fields: checkboxes, multi selects, radios, selects in admin area: System- > Configuration.

 

To indicate Source Model for the field, add tag: <source_model> and define source model in it

<source_model>adminhtml/system_config_source_allregion</source_model>

The field must contain tag: <frontend_type> with one of the values: сheckbox, multi select, radio or select.

 

Magento Module Setup (Part 2)

Part 2

You can find Magento Module Setup (Part 1) here

Now let's take a look at the section: acl

Magento Module Setup (Part 1)

Introduction

Magento as any other modern system is built with the help of modules. And it goes without saying that each module is configured independently. That is why before creating a new module it is necessary to get familiar with Magento module structure.

Magento stores the main module configuration part in etc/config.xml file: