This is more of a template tag question than a programming question, but since WPEC’s wiki and forum is quite useless I had to give it a shot here.
Using shortcodes you can easily include a given number of products from a given category in any post and page.
But how can I achieve the following:
In the bottom of the single product view template I would like to show three random products from the same category as the product that is being viewed.
PS: I’m aware of the related product plugins that exists, but they’re
struggling with the new product variations in WPEC. That’s why I
prefer to use the standard category listing included in WPEC instead.
Thanks in advance for all kinds of help!
Try this in your wpsc-single_product.php template. It will give you a list with title and link. I didn’t test this with product variations, I am not using them in the site I am working with and I wasn’t sure from your question if you needed it to. Hopefully this at least gives you a starting place.
You can get the current category by:
<?php get_the_category( $id ) ?>
– Here id is id of your current post.Than-after use
Random Post from Category
pluginAnd give the current category id to it.
And here you will get all products of the current product category.