Hide Bottom Pagination in Virtuemart
Written by Thomas Kahl   
Monday, 04 January 2010 22:37

Virtuemart shows the bottom pagination even when there is only one page. This doesn’t make sense and a lot of people want to hide this. I have seen some tips where a core hack is suggested. As all of us know, for each core hack god kills a little cat – so if you like cats, don’t do it.

There is a very simple way to hide the pagination with a little change in the pagination theme:

/components/com_virtuemart/themes/default/templates/browse/includes/browse_pagenav.tpl.php

Replace the original content with the following code:

<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); mm_showMyFileName(__FILE__); ?>

<?php if(!@is_object( $pagenav)) return;  ?>

<?php

$pag_string=$pagenav->getPagesLinks( $search_string );

if(!strpos($pag_string,'href')) return; 
?>

<!-- BEGIN PAGE NAVIGATION -->

<div id="footervmnav">

    <?php $pag_string; ?>

</div>

<!-- END PAGE NAVIGATION -->

and save th file. Now the pagination should be gone if not needed.

The “trick” is in line 5 and 6:

$pag_string=$pagenav->getPagesLinks( $search_string );
if(!strpos($pag_string,'href')) return;

Here we first store the pagination-string to a variable. After that, we check if there is a link contained in the string (check for ‘href’). If not, we return without displaying the pagination.

Trackback(0)
Comments (2)Add Comment

Write comment
smaller | bigger

security code
Write the displayed characters


busy