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:

Email Notification of Magento 'Contact Us' Form Submitter

The feature notifies the user who submits 'Contact Us' form on site (the notification will be delivered to the indicated by the user email address).

See the image:

248

The notification message example:

249

To enable the feature:

1. We will extend Contacts settings with the ability to Enable/ Disable notification and the ability to choose the template of the notification to send to the user.

Add file system.xml into the module folder:

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:

How to Add a Custom Table to Magento Admin Backend

In this article we will add a custom table to Magento admin interface. The table that will be displaying information from  the data base table: sales_flat_order_item.

238

Namespace - Ikantam

Module - KnowledgeBase

In the configuration file of the module we will create new item 'Order Items'

239

/app/code/local/Ikantam/KnowledgeBase/etc/config.xml

How to Add a Category Tree with Checkboxes (Admin Interface) into a Custom Magento Module

In Tabs.php file of custom module in  _beforeToHtml method we will add a custom tab after the main (default) tab and will place a category tree there:

$this->addTab('category_tree_tab', array(
		'label'     => Mage::helper('catalog')->__('Category Tree Tab'),
		'url'       => $this->getUrl('modulename/adminhtml_index/categories', array('_current' => true)),
		'class'     => 'ajax',
	));

 

Then in parameter url we should indicate the path to a method categoriesAction (method presented below)

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 Add Custom Renderer to Magento Grid

Magento Grid – a very handy tool for flexible data display. In Magento it is usually  presented as a table. There is a possibility to modify tables if necessary.

To do this, you need to add a column to Magento grid and overwrite the default renderer with a custom one.

In the example below, instead of product id we will be displaying product image in 'Product' id column.  You can see default meaning of the column (before customization):

235

Use this code to add a custom renderer: