2017-02-16 12 views
0

こんにちは私はPrestaShop paymnetモジュールを開発しています。私はすべてのトランザクションをリストし、ヘルパーリストクラスで作成しましたが、ページ区切りオプションを設定しましたが、ページ区切りが正しく機能しません。一番下に1..2..4ページのようなページングが表示されますが、すべてのトランザクションが表示されます。これは、レンダリングヘルパーリストメソッドのコードの一部です。PrestaShop 1.6バックオフィスのページ付けが正しく機能しない

$helper = new HelperList(); 

$helper->show_toolbar = false; 
$helper->no_link = true; 
$helper->_pagination = array(10, 20, 50, 100, 200); 

$content = $this->getCancelRows(); 
$helper->listTotal = count($this->getCancelRows()); 

return $helper->generateList($content, $this->fields_list); 

ありがとうございました!私はdublicateの質問をすると私は合理的ですが、私の研究は成功しません。乾杯!

答えて

0

この問題の解決策を見つけました。結果を改ページするための機能を追加する必要があります。誰かに似たような問題がある場合。私は下に作業コードを貼り付けます。

public function initList() { 
    $content = $this->getCancelRows(); 
    $helper->listTotal = count($this->getCancelRows()); 

    /* Paginate the result */ 
    $page = ($page = Tools::getValue('submitFilter' . $helper->table)) $page : 1; 
    $pagination = ($pagination = Tools::getValue($helper->table . '_pagination')) ? $pagination : 10; 
    $content = $this->paginate_content($content, $page, $pagination); 

    return $helper->generateList($content, $this->fields_list); 
} 

public function paginate_content($content, $page = 1, $pagination = 10){ 
    if (count($content) > $pagination) { 
     $content = array_slice($content, $pagination * ($page - 1), $pagination); 
    } 

    return $content; 
} 
関連する問題