Assuming you want to do this on the product page, try something like this:
The smarty of extra fields are assigned in this file: /modules/Extra_Fields/extra_fields.php
There is already a loop at the bottom of that file that assigns the extra_fields array to the smarty variables. You can add your explode inside that loop, or you can create another one - depending on the conditions you want to do this, or you can add a new loop if you want it always to read the extra field.
There are some print/echo statements in the code to help you debug
Code:
if (!empty($extra_fields)) {
foreach ($extra_fields as $ef_k=>$ef_v) {
if ($ef_v['field'] == "stars") {
echo "explode stars: ";
$explode_stars = explode(',', $ef_v['field_value']);
print_r($explode_stars);
}
$smarty->assign("explode_stars", $explode_stars);
}
Now - the array should be available to your product.tpl. If you use
this tip - you should see the $explode_stars array, and the values in the array as you expect.
Now - in your product template - you need to cycle through the extra fields array and then the $explode_stars array, and set the links that you want based on the values. If you are already looping through extra fields, you can put this inside that loop instead of creating another.
Code:
{section name=field loop=$extra_fields}
{if $extra_fields[field].field eq "stars" && $extra_fields[field].field_value ne ""}
<p>{$extra_fields[field].field_value}</p>
<p>exploded: <br />
{section name=star_name loop=$explode_stars}
{$smarty.section.star_name.index} : {$explode_stars[star_name]} <br />
{/section}
</p>
{/if}
{/section}
Use the smarty variable console while you are debugging to see the variables and what their values (In case I have a code error - you should be able to fix it)