Create Custom Product Types

In this blog post we will see how to create custom product type in magento. Magento has 6 type of products simple, configurable, grouped, bundled, downloadable, virtual. We will see below steps on how to create a custom product type.

Download Module
look for folder “Custom Product Type” for source code

Lets look at the code which needs to be written to create custom product type

In your module config.xml you need to define the new product type

                    <excellence translate="label" module="excellence_test">
                        <label>Excellence Product</label>

Above is how a custom product type is defined. Lets see in detail each configuration option.
label: This is the product type text disabled in admin manage product section.
model: This is the main product type model. This is an important class where you can your custom function to be accessible on product view page etc. This class needs to extends “Mage_Catalog_Model_Product_Type_Abstract”
composite: If the product is composite is or not. Composite means has children or not like configurable, grouped etc.
can_use_qty_decimals: If the product have stock in decimals or not
price_model: This is to define the price model. This is also another important class, here you can define your custom price calculation methods based on request parameters (buyRequest) and other conditions. This class as functions like getFinalPrice(), calculatePrice(), etc. This model should extend “Mage_Catalog_Model_Product_Type_Price”
price_indexer: This is a resource model, which is used for price indexing. This model should extend “Mage_Catalog_Model_Resource_Product_Indexer_Price_Default”

Once you define these classes and xml in config file, your custom product type will start work. But in admin if you try to create product, you will see “Price” tab doesn’t show up and many other attributes don’t show up.
For this to happen we need assign few attributes to the new product type. This is done in “catalog_product_eav” table.

$installer = $this;
/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */


$fieldList = array(

// make these attributes applicable to downloadable products
foreach ($fieldList as $field) {
    $applyTo = split(',', $installer->getAttribute('catalog_product', $field, 'apply_to'));
    if (!in_array('excellence', $applyTo)) {
        $applyTo[] = 'excellence';
        $installer->updateAttribute('catalog_product', $field, 'apply_to', join(',', $applyTo));


The above code assigns attributes to the new product type.