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?
-
1ItepCompany_Incomm_Model_Product_Virtual::ENTITY this cause the problem have you defined the constant?Qaisar Satti– Qaisar Satti2015年05月13日 05:02:35 +00:00Commented May 13, 2015 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 problemMatheus Silva Itep– Matheus Silva Itep2015年05月13日 07:36:31 +00:00Commented May 13, 2015 at 7:36
1 Answer 1
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.