1

I'm doing a module with a new type of product using a helper/model for virtual product, and inserting a new attribute via SQL setup (in Module ...)

My helper model:

class ItepCompany_Incomm_Model_Product_Virtual
    extends Mage_Catalog_Model_Product_Type_Virtual
{
}

My pro mysql-install-0.1.0.php code is:

<?php
$this->startSetup();
$this->addAttribute(ItepCompany_Incomm_Model_Product_Virtual::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,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));

$this->endSetup();

Only when accessing the admin panel of the error:

Fatal error: Undefined class constant 'ENTITY' ... \ sql \ add_product_attribute \ MySQL4-install-0.1.0.php on line 3

Did not generate anything in the log, which caused the problem?

  • 1
    ItepCompany_Incomm_Model_Product_Virtual::ENTITY this cause the problem have you defined the constant? – Qaisar Satti May 13 '15 at 5:02
  • for example, the $this->addAttribute(Mage_Catalog_Model_Product::ENTITY.... , takes the folder app/core/mage/catalog/model/product and creates in the every type of product, i need to create in my custom type of product.... the constant have definitions in model wich i was using, but this error is a problem – Matheus Silva Itep May 13 '15 at 7:36
3
ItepCompany_Incomm_Model_Product_Virtual::ENTITY 

you are trying to get the constant that are not define in your class.

Mage_Catalog_Model_Product::ENTITY

in this class ENTITY constant in define

const ENTITY                 = 'catalog_product';

so solution is that use the default product ENTITY or define in your custom class.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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