Nov
02

How to customise WP e-Commerce Breadcrumbs

I’m posting this here as there doesn’t seem to be any documentation on how to do this. The WP e-Commerce plugin is a decent shopping cart plugin for WordPress, unfortunately it’s documentation is rather poor!

The breadcrumbs (once enabled via the settings in the admin panel) display a breadcrumb trail on your product pages. by default is looks something like this:

Store Name » Products Page » Category Name » Product Name

To edit the output you need to edit the function in the theme files. The function is:

<?php wpsc_output_breadcrumbs (); ?>

You can pass an array of arguments to the function. Your options are:

'before-breadcrumbs' => '<div class="wpsc-breadcrumbs">',
'after-breadcrumbs'  => '</div>',
'before-crumb'       => '',
'after-crumb'        => '',
'crumb-separator'    => ' &raquo; ',
'show_home_page'     => true,
'show_products_page' => true,
'echo'               => true

Now simply pass your arguments to the function, for example:

<?php wpsc_output_breadcrumbs ( array (
 'crumb-separator'    => ' &gt; ',
 'show_home_page'     => false,   
) ); ?>

The above would display breadcrumbs with ‘>’ as a separator and removes the homepage:

Products Page > Category Name > Product Name

I also think its best to put your breadcrumb function in a separate file e.g ‘wpsc-breadcrumbs.php’ then include it in each instance:

<? include "wpsc-breadcrumbs.php"; ?>

This way you don’t need to edit it multiple times should you decide to change something in the future.

I hope this can be of help to someone!

Our Prices RSS Feed