Php 添加了更多信息Magento can';在后端中看不到属性
我在模块设置文件中使用此函数创建了一个属性:Php 添加了更多信息Magento can';在后端中看不到属性,php,mysql,magento,attributes,setup-deployment,Php,Mysql,Magento,Attributes,Setup Deployment,我在模块设置文件中使用此函数创建了一个属性: $this->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'outofstock_date', array( 'group' => 'Inventory', 'input' => 'text', 'type' => 'int', 'label' => 'Out of St
$this->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'outofstock_date', array(
'group' => 'Inventory',
'input' => 'text',
'type' => 'int',
'label' => 'Out of Stock Date',
'visible' => 0,
'required' => 0,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
));
我知道属性的创建是有效的,因为我可以使用以下查询在数据库中找到它:
select * from eav_attribute where attribute_code like '%stock%';
但是,我在后端找不到它。它没有出现在“编辑产品”页面上,我无法在“属性管理”屏幕或“属性集”屏幕中看到它。我在创建它时做错了什么?为什么我在后端找不到它
另外:上述内容在mysql4-install-0.1.0.php安装文件中,触发它的配置文件部分如下:
<resources>
<giftlab_inventory_setup>
<setup>
<module>Giftlab_Inventory</module>
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
</giftlab_inventory_setup>
</resources>
礼品库存
Mage\u目录\u模型\u资源\u Eav\u Mysql4\u设置
修复了安装程序脚本:
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'outofstock_date', array(
'group' => 'Inventory',
'input' => 'date',
'type' => 'datetime',
'label' => 'Out of Stock Date',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'backend' => 'eav/entity_attribute_backend_datetime',
));
$installer->endSetup();
再次检查属性集管理器,并尝试在库存组或右侧的“未分配”中找到它。@KalpeshMehta我找到了,但找不到它。我甚至尝试重新索引所有内容(缓存已禁用),但仍然没有。请验证您的安装脚本是否已成功运行..检查core_资源表中的条目。条目显示在core_资源表中,正如我所说,该属性确实已插入。我想问题可能出在我使用的课程上?这并不能回答这个问题。若要评论或要求作者澄清,请在他们的帖子下方留下评论-你可以随时在自己的帖子上发表评论,一旦你有足够的评论,你就可以发表评论了。@RomanC谢谢你的评论,你能告诉mw为什么我的回答没有指出他问题的原因吗?