0

I am trying to make a module to hide product types when tryng to create a new product.

I have created the files as follows:

app\etc\modules\Grando_Producttype.xml

<?xml version="1.0"?>
<Grando_Producttype>
        <active>true</active>
        <codePool>local</codePool>
</Grando_Producttype>

app\code\local\Grando\Producttype\etc\config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Grando_Producttype>
            <version>1.0</version>
        </Grando_Producttype>
    </modules>
    <global>
        <models>
            <catalog>
                <rewrite>
                    <product_type>Grando_Producttype_Model_Product_Type</product_type>
                </rewrite>
            </catalog>
        </models>
    </global>     
</config>

app\code\local\Grando\Producttype\Model\Product\Type.php

<?php 
class Grando_Producttype_Model_Product_Type extends Mage_Catalog_Model_Product_Type
{
    static public function getOptionArray()
{
    $options = array();
    foreach(self::getTypes() as $typeId=>$type) {
        if($typeId == 'virtual'):
            $options[$typeId] = Mage::helper('catalog')->__($type['label']);
        endif;
    }

    return $options;
}
}

This should be working good I think, but for some reason it is not loading and all products still show up and I have no idea why and can't find the reason. I am quite new to Magento. Is there any configuration I might be missing? I've already tryed to change my class name to Grando_Producttype_Model_Product_Type and no success...

Cache is not activated,

Any help will be appreciated! Thanks

1 Answer 1

1

I assume your app\etc\modules\Grando_Producttype.xml is wrong, it should look like

<?xml version="1.0"?>
<config>
    <modules> <!-- missing node? -->
        <Grando_Producttype>
            <active>true</active>
            <codePool>local</codePool>
        </Grando_Producttype>
    </modules>
</config>
1
  • Nice!! I knew it could be something very simple that I just overlooked, I was for hours looking at this. Thank you very much and sorry for any inconvenience.
    – Gabriel G
    Commented Mar 22, 2018 at 20:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.