Conditional check to show/hide navigation block in tpl_modules_product_listing:
PHP Code:
<?php if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<div id="productsListingTopNumber" class="navSplitPagesResult back"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></div>
<div id="productsListingListingTopLinks" class="navSplitPagesLinks forward"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'x', 'y', 'main_page'))); ?></div>
<br class="clearBoth" />
<?php
}
?>
If I set maximum products per page to, say, 10 and only have 2 products, the above logic will still print the div blocks although they are empty. This is because $listing_split->number_of_rows is set to the total count in \includes\classes\split_page_results.php
To display navigation block only when there is more than 1 page, I believe the correct logic should be:
PHP Code:
<?php if ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) { ?>
<!-- show 'Displaying x of y' -->
<div id="productsListingTopNumber" class="navSplitPagesResult back"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></div>
<?php if ($listing_split->number_of_pages > 1) { ?>
<!-- show navigation when there is more than 1 page -->
<div id="productsListingListingTopLinks" class="navSplitPagesLinks forward"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'x', 'y', 'main_page'))); ?></div>
<?php } ?>
<br class="clearBoth" />
<?php } ?>
Apologize if this is not a bug
Bookmarks