app\design\adminhtml\default\default emplate\page\header.phml 添加用于在类别常规选项卡中创建属性的代码我添加此代码

    require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute  = array(
    'type' => 'int',
    'label'=> 'Your attribute label',
    'input' => 'boolean',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible' => true,
    'required' => false,
    'user_defined' => true,
    'default' => "",
    'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'your_attribute_code', $attribute);
$installer->endSetup();

然后我在 magento 类别选项卡中显示错误

Fatal error: Class 'Varien_Data_Form_Element_Boolean' not found in \magento\lib\Varien\Data\Form\Abstract.php on line 146

删除此代码后显示此错误 可以做什么来解决这个错误

有帮助吗?

解决方案

我在这个链接中找到这个答案https://stackoverflow.com/questions/5718954/varien-data-form-element-int-not-found-in-magento

在这个链接中它对我有用。我进行了2张投票

尝试改变 'input' => 'int', to 'input' => 'text',. 。如果该寄存器已在表中,请转至 eav_attribute 搜索您的行并更改字段 frontend_inputtext.

许可以下: CC-BY-SA归因
scroll top