lundi 29 juin 2015

Implementing Jquery Pagination to Opencart Admin page


I am trying to add jquery pagination plugin to opencart Admin page(Catalog > Options > Option value)( /admin/view/template/catalog/option_form.tpl ).

When you click on edit option it loads option values. I have lots of those that is why I am trying to implement paging.

I tried many jquery plugins but to no avail as the plugins have no effect.

Is there any way I can implement paging using jquery or is there any other method i can use?

Thanks.

[Edit]

Whatever i know i tried in php and it is not working.

  EDIT:

I tried one more thing: in admin/controller/catalog/product/option.php

in the method: public function edit() {

I added this code:

<code>

    $pagination = new Pagination();
    $pagination->total = $option_value_total;
    $pagination->page = $page;
    $pagination->limit = $this->config->get('config_limit_admin');
    $pagination->url = $this->url->link('catalog/option/edit', 'token='     . $this->session->data['token'] . $url . '&page={page}', 'SSL');

    $data['pagination'] = $pagination->render();

    $data['results'] = sprintf($this->language->get('text_pagination'), ($option_value_total) ? (($page - 1) 
                        * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) 
                        * $this->config->get('config_limit_admin')) > ($option_total - $this->config->get('config_limit_admin'))) ? $option_value_total : ((($page - 1) 
                        * $this->config->get('config_limit_admin')) 
                        + $this->config->get('config_limit_admin')), $option_value_total, ceil($option_value_total / $this->config->get('config_limit_admin')));

</code>
In Option_form.tpl
<code> 

    <div class="row">
        <div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
        <div class="col-sm-6 text-right"><?php echo $results; ?></div>
    </div>

</code>
In admin/model option.php

in <code>public function getOptionValues($option_id) {</code> I added 
<code> 

    if (isset($data['start']) || isset($data['limit'])) {
        if ($data['start'] < 0) {
        $data['start'] = 0;
        }

        if ($data['limit'] < 1) {
        $data['limit'] = 20;
        }

        $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
        }

        $query = $this->db->query($sql);

        return $query->rows;

</code>


Aucun commentaire:

Enregistrer un commentaire