2

我用他的收藏创建了一个自定义模型,但是当我尝试获取收藏时它返回 false

$categorie = Mage::getModel("planet/categories")->getCollection(); // return false

以上,我写的所有代码:

应用程序/代码/本地/Anas/Planet/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
      <Anas_Planet>
        <version>0.1.0</version>
      </Anas_Planet>
    </modules>
    <global>
    <models>
        <planet>
        <class>Anas_Planet_Model</class>
        <ressourceModel>planet_resource</ressourceModel>
        </planet>
        <planet_resource>
        <class>Anas_Planet_Model_Resource</class>
        <entities>
            <categories>
            <table>planet_categories</table>
            </categories>
        </entities>
        </planet_resource>
    </models>
    <resources>
        <planet_setup>
        <setup>
            <module>Anas_Planet</module>
            <class>Anas_Planet_Model_Resource_Setup</class>
        </setup>
        <connection>
            <use>core_setup</use>
        </connection>
        </planet_setup>
        <planet_write>
        <connection>
            <use>core_write</use>
        </connection>
        </planet_write>
        <planet_read>
        <connection>
            <use>core_read</use>
        </connection>
        </planet_read>
    </resources>
    <helpers>
        <planet>
        <class>Anas_Planet_Helper</class>
        </planet>
    </helpers>
    </global>
</config>

app/code/local/Anas/Planet/Model/Categories.php

class Anas_Planet_Model_Categories extends Mage_Core_Model_Abstract {

    protected function _construct() {
        $this->_init('planet/categories');
    }

}

app/code/local/Anas/Planet/Model/Resource/Categories.php

class Anas_Planet_Model_Resource_Categories extends Mage_Core_Model_Resource_Db_Abstract {

    protected function _construct() {
        $this->_init('planet/categories', '_id');
    }

}

app/code/local/Anas/Planet/Model/Resource/Categories/Collection.php

class Anas_Planet_Model_Resource_Categories_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {

    protected function _construct() {
       $this->_init('planet/categories');
    }

}

有人知道我的错误在哪里吗?

4

1 回答 1

4

我现在认为这是一个简单的错字。尝试resourceModel而不是ressourceModel在您的 config.xml 中。

于 2013-06-17T14:40:32.230 回答