Never mind! I fixed it after a load of research and trial and error.
As each product page used the same category, I was able to create an array of these pages, then create another array of the exploded values for “category” from each page using nested foreach loops.
I then used the function, “array_unique” to remove duplicates from the list. Please excuse the simplistic explanation as well as code, I wrote it for people like myself who need the extra detail!
<?php
$pages = get_posts(array(
'post_type' => 'page',
'meta_key' => '_wp_page_template',
'meta_value' => 'product.php'
));
$catlist = array();
foreach($pages as $page){
$categories = get_post_meta($page->ID, 'categories', true);
$categories = explode(',' , $categories);
foreach($categories as $category){
$catlist[] = $category;
}
}
$unique_catlist = array_unique($catlist);
?>