VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Alexb65 on October 07, 2022, 11:08:17 AM

Title: VM 4.0.7 Joomla 4.2.3 Administrator pagination broken quick fix
Post by: Alexb65 on October 07, 2022, 11:08:17 AM
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



Title: Re: VM 4.0.7 Joomla 4.2.3 Administrator pagination broken quick fix
Post by: hazael on October 07, 2022, 17:52:04 PM
All you need is a CSS short code
https://forum.virtuemart.net/index.php?topic=148913.0
Title: Re: VM 4.0.7 Joomla 4.2.3 Administrator pagination broken quick fix
Post by: Alexb65 on October 10, 2022, 14:02:10 PM
Thanks!