Jump to content

add pagination to an existing opencart module


espansio

Recommended Posts

Hello,

 

First time asking technical question in a forum so I beg pardon for errors.

 

I have a third party blog module installed on opencart. The original coder helped me to fix some bugs, but he is not answering anymore to emails.

I would like to add a simple pagination to the "latest articles"  part, because at the moment the website display the exact number declared in "article limit" and does not show pagination if articles shown are less than the total.

 

the code from "article_by_type.php" line 85  is the following:

/*recent_article*/

        if ($setting['article_type']=='recent_article') {

        $data = array(

                    'sort'  => 'p.date_added',

                    'order' => 'DESC',

                    'start' => 0,

                    'limit' => $article_limit

                );

        

                $articles = $this->model_news_article->getArticles($data);

        }

another file "article_list.php" at line 88 and 214 already have pagination:

 

$this->data['article_ajax_load'] = $this->getArticle($article_category_id,$page,$limit,$description_limit);
                    
            $pagination = new Pagination();
            $pagination->total = $article_total;
            $pagination->num_links = 3;
            $pagination->page = $page;
            $pagination->limit = $limit;
            $pagination->text = $this->language->get('text_pagination');
            $pagination->url = 'index.php?route=module/article_list/getlist&cpath='.$article_category_id. '&page={page}'.'&limit=' .$limit;
        
            $this->data['pagination'] = $pagination->render();

 

can anyone help add pagination to "article_by_type.php" or adapt the existing pagination code to it ?

article_by_type.php

article_list.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.