This is for use with WP e-Commerce plugin. Use this code if you want to show the “Product Tags” as links. It works in the single product page container in wpsc-single_product.php
.
A Caveat to Using Tag Links In WP e-Commerce
One drawback is that, as of WP e-Commerce version 3.8.8, it does not support pagination for Tags. Tags don’t function the same exact way as “Product Categories”, so extra code would have to be written to support pagination for Tags.
But for now, this code is useful if you have less products per tag than per page, so that pagination will not be an issue. You can increase your number of “products per page” in the ‘Store Settings’ in the WordPress dashboard.
And now the code. Place it within the product loop in wpsc-single_product.php
.
<!-- show product tags as links --> <p class="tagged-with">See Similar Items: <?php $wpsc_product_tags = get_the_product_tags( wpsc_the_product_id() ); if ($wpsc_product_tags) { foreach ($wpsc_product_tags as $wpsc_product_tag) { $tagname = $wpsc_product_tag->name; $tagid = $wpsc_product_tag->term_id; $taglink = get_term_link( $wpsc_product_tag->slug, $wpsc_product_tag->taxonomy ); echo '<a href="'.$taglink.'">'.$tagname.'</a>, '; } } ?> </p>
Eric Macedonia
October 4th, 2012 at 1:56 pm
This is EXACTLY what I was looking to do on my product pages !! Thanks for sharing this.
-Eric
Ben
April 18th, 2013 at 2:29 pm
Is there a way to create a custom template to display all of the items with a particular tag?
Isabel
April 18th, 2013 at 8:55 pm
I have not used WPEC or looked at its code in about a year. Unless they’ve changed the name, the taxonomy for product tags is:
product_tag
.So create a template file called
taxonomy-product_tag-{your-particular-tag}.php
and it will be used automatically when viewing that tag’s archives.Replace the curly brackets and the text inside them with the slug of your particular tag. Hope this helps.
leo
October 27th, 2013 at 11:01 pm
why not putting wpsc_the_product_tags() on wpsc-single_product.php ?