I’m doing a site for a client using WP e-Commerce and they are using it as a catalogue site, not a e-commerce site.
One thing they wanted to be able to do was to use the Product Downloads for hosting attachments for individual products, for example, a PDF info sheet. The built-in functionality of WP e-Commerce however is to only display the product downloads links once someone has purchased an item and gone through the checkout process.
I found a guide on bloke.org showing how to do it in 3.7, but in version 3.8 they changed the way that the product downloads were stored and the old way no longer worked.
After much head-scratching, I arrived at the following solution:
$args = array( 'post_type' => 'wpsc-product-file', 'numberposts' => -1, 'post_parent' => $post->ID );
$attachments = get_children($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
echo "<a href=", $attachment->guid, ">$attachment->post_title</a>";
}
}
I was reading the same solution on bloke.com then found your comment as I am using WPEC 3.8.9.5. The issue I had is that on single product pages all downloads were being displayed. It seems the $post->ID is not used in WPEC 3.8.9.5 and was replaced by the function: wpsc_the_product_id();
I was able to store the above returned ID into a var then pass that to your function above, replacing $post-ID with var.
Below is the code I used in case others have a similar issue:
In the wpsc-single-product.php page:
$postID = wpsc_the_product_id();
get_downloads($postID);
In my Functions.php file:
function get_downloads($postID)
{
$args = array( 'post_type' => 'wpsc-product-file', 'numberposts' => -1, 'post_parent' => $postID );
$attachments = get_children($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
echo "guid, ">$attachment->post_title";
}
}
}