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?

7ochem
7,61516 gold badges54 silver badges82 bronze badges
asked May 13, 2015 at 4:52
2
  • 1
    ItepCompany_Incomm_Model_Product_Virtual::ENTITY this cause the problem have you defined the constant? Commented 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 problem Commented May 13, 2015 at 7:36

1 Answer 1

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.

answered May 13, 2015 at 7:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.