Showing results for 
Search instead for 
Did you mean: 

[module] Need to create a new attribute in a new type of product

[module] Need to create a new attribute in a new type of product

I am creating a module to insert a new attribute and a new type of product in my store. As template, I use the same registration screen of the Virtual Product type and include new options ONLY this type of product. For this, in my config.xml, I used:

                    <incomm_virtual translate="label" module="incomm">
                        <label>Incomm Virtual</label>

and to configure the installation with the sql in same config.xml:


The next file was used mymodule / model / product / type.php containing:

class ABC_Incomm_Model_Product_Type
        extends Mage_Catalog_Model_Product_Type_Virtual
    const TYPE_INCOMM          = 'incomm';
    const XML_PATH_AUTHENTICATION = 'catalog/incomm/authentication';

    protected function _prepareProduct(Varien_Object $buyRequest, $product, $processMode)
        if ($this->_isStrictProcessMode($processMode)) {
            return Mage::helper('ABC_Incomm_Helper_Data')->__(
                'Incomm product %s cannot be added to cart. ' .
                ' On the product detail page click the "Go to parent site"'.
                ' button to access the product.',                $product->getName()
        return parent::_prepareProduct($buyRequest, $product, $processMode);

In the same folder, the virtual.php:

class ABC_Incomm_Model_Product_Virtual extends Mage_Catalog_Model_Product_Type_Virtual {   

Finally, the SQL installation file in sql folder / abc_incommproduct_setup / mysql-install-4-0.1.0.php:

$this->startSetup();$this->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'terms_of_use', array(
    'group'         => 'General',
    'input'         => 'textarea',
    'type'          => 'text',
    'sort_order' => 4,
    'label'         => 'Terms of use',
    'backend'       => '',
    'visible'       => true,
    'required'      => true,
    'wysiwyg_enabled' => true,
    'visible_on_front' => true,
    'apply_to'                => 'incomm', //only in this type of product
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,

My problem is this, after disabling the cache in magento, clear the cache and include a new type of product, in the Product Types list appears my NEW type of product, but the options NOT load the new attribute inserted via sql, the What's happening? my sqlinstall.php did not run ??