2011-06-20 6 views
0

私は 異なるモデルが:

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

Exception printing is disabled by default for security reasons. 

Error log record number: 1685082734 

そして、私のコレクションクラスは以下の通りです、今私はコレクションを取るために他のモデルを使用したいのですが、thatsのは私にエラーを与え、Magentoの中にモジュールを作成します..

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

カスタムモジュールに別のモデルを追加したい場合は、yourmodule/etcフォルダにあります​​3210ファイルにあなたのテーブル名を入力する必要があります。その後

<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'); 
} 
関連する問題