2016-06-23 9 views
1

私はモジュールフォルダにコントローラを作成していますが、モジュールフォルダ名は "productarticle"で、コントローラファイル "AdminProductarticleController.php"はパス "productarticle/controllers/admin"に存在します。PrestaShop管理モジュールコントローラが見つかりません

コントローラのコードは下に記載されて:

class AdminProductarticleController extends ModuleAdminController 
{ 
    public function __construct() 
    { 
     echo Tools::getValue('id_product'); 
    } 
} 

そして私は、URLの下に使用して、このコントローラにアクセスしようとしています:

http://myshost/admin/index.php?fc=module&module=productarticle&controller=AdminProductarticle&id_product=1&token=mytoken 

しかし、エラーの下に示す前述のURLを使用することにより:

enter image description here

私に教えてくださいここで何か悪いことをする。

ありがとうございます。

答えて

1

これは私の新しいコントローラのメニューエントリを作成していなかったためです。

あなたがすることをアドバイスするには、[管理]> [メニュー]の順に選択して新しいエントリを作成します。

このような形式で入力します。その上で

Name: Productarticle 
Class: AdminProductarticle 
Module: productarticle (if that's the name you gave your module) 
Active: NO (this way you don't have to have a menu entry that's gonna be useless to you) 

を使用すると、以降のすべてが問題ないはずです。この点から、あなたの__construct()

class AdminProductarticleController extends ModuleAdminController 
{ 
    public function __construct() 
    { 
     $this->module = 'productarticle'; //refers to your module's $this->name = 'productarticle'; 
     $this->bootstrap = true; 
     $this->context = Context::getContext(); 
     //The following 2 lines are useful if you have to link your controller to a certain table for data grids 
     $this->table = 'contribution'; 
     $this->className = 'Contribution'; 

     parent::__construct(); 
    } 
} 

でこのような何かを持っている必要があります。

+0

ありがとうございます、あなたの提案は私のために働く。 –

+0

うれしい私は助けになることができます。ドキュメンテーションにはモジュール開発のいくつかのコア側面が欠けています。実際に試してみたり、リモートWebサイトで検索したり、コアを掘り下げて答えを見つける必要があります。私はそれがかなり悲しいことを見つける。 –

+0

@JulienLachal私はあなたが本当にこの行を必要としないと思う "$ this-> context = Context :: getContext();" –

関連する問題