【发布时间】:2014-06-20 13:52:43
【问题描述】:
感谢这篇文章 Add a checkbox to product image gallery (like "Disable/Exclude") 我能够在 magento 后端的产品媒体库中添加新的复选框。首先,我在 magento 核心中进行了这些更改,它们就像一个魅力 :) 然后我决定用我自己的模块覆盖它们,如下所示:
<?xml version="1.0"?>
<config>
<modules>
<My_Gallery>
<version>1.0.0</version>
</My_Gallery>
</modules>
<global>
<helpers>
<my_gallery>
<class>My_Gallery_Helper</class>
</my_gallery>
</helpers>
<models>
<my_gallery>
<class>My_Gallery_Model</class>
</my_gallery>
<my_gallery_resource>
<class>My_Gallery_Model_Resource</class>
</my_gallery_resource>
<catalog>
<rewrite>
<product_attribute_backend_media>My_Gallery_Model_Product_Attribute_Backend_Media</product_attribute_backend_media>
</rewrite>
</catalog>
<catalog_resource>
<rewrite>
<product_attribute_backend_media>My_Gallery_Model_Resource_Product_Attribute_Backend_Media</product_attribute_backend_media>
</rewrite>
</catalog_resource>
</models>
<blocks>
<my_gallery>
<class>My_Gallery_Block</class>
</my_gallery>
</blocks>
<resources>
<my_gallery_setup>
<setup>
<module>My_Gallery</module>
<class>My_Gallery_Model_Resource_Setup</class>
</setup>
</my_gallery_setup>
</resources>
</global>
但在这样做之后,我收到了来自主题的错误:异常“Mage_Eav_Exception”,消息“指定的后端模型无效:目录/product_attribute_backend_media”
可能是什么问题?
问候,
【问题讨论】:
-
你能展示你的模型文件吗?
-
检查您的日志以查看是否有任何失败的包含发生。就我而言,我的 XML 没有正确定义模型,所以 magento 试图从 Mage/ 命名空间加载它: ERR (3): Warning: include(): Failed opening 'Mage/YOUR_NAMESPACE/YOUR_MODULE/Model/Entity/ Attribute/Backend/Customergroups.php' 包含在第 94 行的 my_document_root/lib/Varien/Autoload.php 中
标签: magento