VM 4.0.7 Joomla 4.2.3 Administrator pagination broken quick fix

Started by Alexb65, October 07, 2022, 11:08:17 AM

Previous topic - Next topic

Alexb65

Hi all

In admin the pagination links are completely out of order

Here is a quick fix that uses Joomla native CSS classes to show the toolbar

in /administrator/components/com_virtuemart/helpers/vmpagination.php

in method _list_render (around line 629)

change:

$html = '<ul>';
$html .= '<li class="pagination-start">' . $list['start']['data'] . '</li>';
                $html .= '<li class="pagination-prev">' . $list['previous']['data'] . '</li>';
                foreach ($list['pages'] as $page)
                {
                        $html .= '<li >' . $page['data'] . '</li>';
                }
                $html .= '<li class="pagination-next">' . $list['next']['data'] . '</li>';
                $html .= '<li class="pagination-end">' . $list['end']['data'] . '</li>';
                $html .= '</ul>';
             


to:

$html="<nav class='pagination__wrapper'><div class='pagination pagination-toolbar text-center'>";
                $html .= '<ul class="pagination ms-auto mb-4 me-0">';

                $html .= '<li class="pagination-start">' . $list['start']['data'] . '</li>';
                $html .= '<li class="pagination-prev">' . $list['previous']['data'] . '</li>';
                foreach ($list['pages'] as $page)
                {
                        $html .= '<li class="page-item">' . $page['data'] . '</li>';
                }
                $html .= '<li class="pagination-next">' . $list['next']['data'] . '</li>';
                $html .= '<li class="pagination-end">' . $list['end']['data'] . '</li>';
                $html .= '</ul>';
                $html .="</div></nav>";


in method _item_active (around line 654) you need to add class="page-link"

if (!VmConfig::isSite())
                {
                        if ($item->base > 0)
                        {
                                return "<a [bclass=]'page-link'[/b] title=\"" . $item->text . "\" onclick=\"document.adminForm." . $this->prefix . "limitstart.value=" . $item->base
                                . "; Joomla.submitform();return false;\">" . $item->text . "</a>";
                        }
                        else   
                        {
                                return "<a class='page-link' title=\"" . $item->text . "\" onclick=\"document.adminForm." . $this->prefix
                                . "limitstart.value=0; Joomla.submitform();return false;\">" . $item->text . "</a>";
                        }
                }

in method _item_inactive  (around line 697)

do the following:
if (!VmConfig::isSite())
    698                 {
    699                         return "<span class='page-link'>" . $item->text . "</span>";
    700                 }
    701                 else ...

now you have a native joomla pagination bar working ok