2016-12-07 7 views
1

Prestashop用のモジュールを作成してAdminProductsControllerをオーバーライドし、BackOfficeのProductsビューのバルクアクションメニューに2つのアクションを追加します。これは、オーバーライドクラスの構造製品にバルクアクションを追加する際にプレスタシップにセパレータ/ディバイダを追加する方法

public function __construct() { 
    parent::__construct(); 
    $this->bulk_actions['exportSelected'] = array(
     'text' => $this->l('Export selected'), 
     'icon' => 'icon-cloud-upload', 
     'confirm' => $this->l('Are you sure you want to export selected products ?') 
    ); 
    $this->bulk_actions['exportAll'] = array(
     'text' => $this->l('Export all'), 
     'icon' => 'icon-cloud-upload', 
     'confirm' => $this->l('Are you sure you want to export all products ?') 
    ); 
} 

で一括操作を追加するための結果は、この

Bulk Actions Menu

である私は選択削除の間のセパレータを追加したいと思い、私が持っているコードで、 輸出先を選択。つまり、私が新しく追加した項目の前にを追加するということです。どうすればこれを達成できますか?

答えて

2

アクションを追加する前にディバイダを追加してください。

public function __construct() { 
    parent::__construct(); 
    /* 
    * $this->bulk_actions key can be anything except 'divider' as it already 
    * gets added for 'Enable/disabled selection' 
    * (and other already defined actions of course) 
    */ 
    $this->bulk_actions['my_actions_divider'] = array( 
     'text' => 'divider' 
    ); 
    $this->bulk_actions['exportSelected'] = array(
     'text' => $this->l('Export selected'), 
     'icon' => 'icon-cloud-upload', 
     'confirm' => $this->l('Are you sure you want to export selected products ?') 
    ); 
    $this->bulk_actions['exportAll'] = array(
     'text' => $this->l('Export all'), 
     'icon' => 'icon-cloud-upload', 
     'confirm' => $this->l('Are you sure you want to export all products ?') 
    ); 
} 
+0

パーフェクト。コードに追加したコメントは、キー名「divider」を持つ仕切りを追加していて、機能していなかったので、明らかになっています。今なぜ私は見ることができます。ありがとう –

関連する問題