It doesn’t appear possible to loop over the values multiple times without directly manipulating the current_custom_meta
class var so that wpsc_have_custom_meta()
will return true
again. Give this a try before the second while loop:
global $wpsc_custom_meta;
$wpsc_custom_meta->rewind_custom_meta();
$wpsc_custom_meta->current_custom_meta = -1;