Last Updated: May 03, 2017
·
2.258K
· dsalvagni

Magento - Hide product types

To hide some options of product types avaiable we need to rewrite one core model method: /core/Mage/Catalog/Product/Type.php

1. Step one

Create your module - i'm pretty sure you know how to do this step

2. Step two

Add the rewrite configuration into the config.xml in your module as below:

<?xml version="1.0"?>
<config>
    <global>
    <models>
        <catalog>
            <rewrite>
                <product_type><Namespace>_Catalog_Model_Product_Type</product_type>
            </rewrite>
        </catalog>
    </models>
</global>
</config>

3. Step three

Add the new method to your custom file

<?php 
class <Namespace>_Catalog_Model_Product_Type extends Mage_Catalog_Model_Product_Type
{
    static public function getOptionArray()
    {
        $options = array();
        foreach(self::getTypes() as $typeId=>$type)
        {
            /*
             - Product Simple: catalog/product_type_simple
             - Virtual Product : catalog/product_type_virtual
             - Bundle Product : catalog/bundle/product_type
             - Downloadable Product : downloadable/product_type
             - Configurable Product : catalog/product_type_configurable
             - Grouped Product : catalog/product_type_grouped
            */
            if(
                $type['model'] != "catalog/product_type_virtual"
                && $type["model"] != "bundle/product_type"
                && $type["model"] != "downloadable/product_type")
            {
                $options[$typeId] = Mage::helper('catalog')->__($type['label']);
            }
        }

        return $options;
    }
}