2011-06-20 20 views
0

我建立在Magento模塊,現在我想用其他的模式,以集合,但多數民衆贊成在給我的錯誤,不同的模式在Magento爲同一模塊:

**Error:** There has been an error processing your request 

Exception printing is disabled by default for security reasons. 

Error log record number: 1685082734 

我的收藏類如下..

class Mage_Banners_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract 

{ 

    public function _construct() 

    { 
     parent::_construct(); 

     $this->_init('banners/category'); 

    } 
} 

那麼如何運行這個以及這個模型資源如何知道表有..?

+0

您在該報告中出現什麼錯誤? – jamapag

+0

@jamapag,上面一個**錯誤:** –

+2

我的意思是進入你的magento的'var/reposts'目錄並閱讀'1685082734'文件中錯誤的描述。 – jamapag

回答

1

如果你想另一個模型添加到您的自定義模塊,你應該在​​3210文件,該文件位於yourmodule/etc文件夾中輸入你的表名:

<entities> 
<banners> 
    <table>Your table Name here</table> 
</banners> 

之後,你應該添加您的集合類在相應的model/mysql4/category/Collection.php。您應該在模型/文件名中創建模型類。

假設category.php是模型文件,您應該使用這些方法啓動該模型類。這些文件應位於model文件夾中:

public function _construct() 
{  
    // Note that the category_id refers to the key field in your database table. 
    $this->_init('banner/category', 'category_id'); 
}