I’m having trouble displaying variations in a custom built template, each time i call the wpsc function have_variation_groups() within my loop i get the following php error
commerce/wpsc-includes/product-template.php on line 1419 [22-Nov-2012 23:27:39] PHP Fatal error: Call to a member function have_variation_groups() on a non-object in /home/tofapost/public_html/sandbox/wp/wp-content/plugins/wp-e-commerce/wpsc-includes/product-template.php on line 1419.
have_variation_groups() is being called inside a WP_Query loop like so;
$args = array('post_type' => 'wpsc-product', 'posts_per_page' => -1);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post();
...
<?php if (wpsc_have_variation_groups()) { ?>
<fieldset>
<legend>
<?php _e( 'Product Options', 'wpsc'); ?>
</legend>
<div class="wpsc_variation_forms">
<table>
<?php while (wpsc_have_variation_groups()) : wpsc_the_variation_group();
?>
<tr>
<td class="col1">
<label for="<?php echo wpsc_vargrp_form_id(); ?>">
<?php echo wpsc_the_vargrp_name(); ?>:</label>
</td>
<?php /** the variation HTML and loop */?>
<td class="col2">
<select class="wpsc_select_variation" name="variation[<?php echo wpsc_vargrp_id(); ?>]"
id="<?php echo wpsc_vargrp_form_id(); ?>" <?php while (wpsc_have_variations())
: wpsc_the_variation(); ?>
<option value="<?php echo wpsc_the_variation_id(); ?>" <?php echo wpsc_the_variation_out_of_stock();
?>>
<?php echo wpsc_the_variation_name(); ?>
</option>
<?php endwhile; ?>
</select>
</td>
</tr>
<?php endwhile; ?>
</table>
</div>
<!--close wpsc_variation_forms-->
</fieldset>
<?php } ?>
...
endwhile;
Whats strange is other wpsc functions like, wpsc_the_product_id() and wpsc_product_has_stock() work while no functions related to variations do...
Any help appreciated
Thanks