Hey,
I'm using the table format and suggestiions from this thread:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=247397
to add a table of retailers and retailer links to display on my detailed pages. I'm using the following global:
sub {
my $id = shift;
my $retailers = $DB->table('Retailers', 'RetailerLinks')->select( { link_id_fk => $id } )->fetchall_hashref;
my $output = qq~~;
foreach my $retailer (@$retailers) {
$output .= "<span class='buylink'><a href='$retailer->{rl_url}'>Buy Now</a></span><br />";
}
return $output;
}
and placing
<%buy_now($ID)%>
in the detailed page. This works fine as long as there is only one Retailer in the retailer table. If there are 2, it shows a link on the detailed page for both retailers even though the RetailerLinks table only has a match for one Link $ID.
Any suggestions? Does this need to run through a loop or something?
I'm using the table format and suggestiions from this thread:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=247397
to add a table of retailers and retailer links to display on my detailed pages. I'm using the following global:
sub {
my $id = shift;
my $retailers = $DB->table('Retailers', 'RetailerLinks')->select( { link_id_fk => $id } )->fetchall_hashref;
my $output = qq~~;
foreach my $retailer (@$retailers) {
$output .= "<span class='buylink'><a href='$retailer->{rl_url}'>Buy Now</a></span><br />";
}
return $output;
}
and placing
<%buy_now($ID)%>
in the detailed page. This works fine as long as there is only one Retailer in the retailer table. If there are 2, it shows a link on the detailed page for both retailers even though the RetailerLinks table only has a match for one Link $ID.
Any suggestions? Does this need to run through a loop or something?