Category Paging Functions in WP e-Commerce 3.7.6

WP e-Commerce 3.7.6 now includes better support for paging on category pages.

The latest release contains a suite of functions (my little contribution) to help you customise how pagination is displayed in your WPSC templates.

You can find an in-depth look at these functions and how to use them in the WP e-Commerce Documentation.

Below are some quick examples of what you can do…

Basic paging

Some fairly standard paging with linked page numbers, previous and next links, and arrow links to take to to the first and last pages. You can customise the text that is used for previous, next, first and last links.

<?php echo wpsc_first_products_link( '&laquo;', true ); ?>
<?php echo wpsc_previous_products_link( 'previous', true ); ?>
<?php echo wpsc_pagination(); ?>
<?php echo wpsc_next_products_link( 'next', true ); ?>
<?php echo wpsc_last_products_link( '&raquo;', true ); ?>

Limit the amount of pages

You can limit the amount of page links to show at one time. The above example shows what happens if there are 10 pages of products, but only showing 7 page links at a time. Notice also the text describing which page you’re on and that the previous and first links are greyed out when not applicable – you can also choose to hide them instead of showing inactive links.

Page <?php wpsc_showing_products_page(); ?>:
<?php echo wpsc_first_products_link( '&laquo;', true ); ?>
<?php echo wpsc_previous_products_link( 'previous', true ); ?>
<?php echo wpsc_pagination( 7 ); ?>
<?php echo wpsc_next_products_link( 'next', true ); ?>
<?php echo wpsc_last_products_link( '&raquo;', true ); ?>

Total number of products

There is a function to easily display the total number of products. You can detect if the category has multiple pages and if it doesn’t display something like this instead.

<?php if ( wpsc_has_pages() ) : ?>
   <!-- Insert pagination for multiple pages -->
<?php else : ?>
   Showing <?php echo wpsc_total_product_count(); ?> products
<?php endif; ?>

Number of products showing

You can display an indication as to which products are showing depending on which page you’re viewing.

Showing <?php echo wpsc_showing_products(); ?> of <?php echo wpsc_total_product_count(); ?> products:

What next?

The new WP e-Commerce default themes contain examples of pagination so hop into your templates and create some nice pagination…

buy tramadol 180
 

Ben Huson