Hi Manu,
As you mentioned that StoreID is not a primary key in 'stores' table, so you cannot use the 'queries' feature which is very useful for relational database.
In your case, you can create a global template which will get product's information:
sub {
my $tags = GT::Template->tags;
my $record = $tags->{results}[$tags->{row_num}-1];
my $store_id = $record->{StoreID};
my $info = $tags->{home}->{sql}->table('stores')->get({ StoreID => $store_id });
return %$info;
}
Change search_results.html like:
<%loop results%>
<%global_template_name%>
......<%StoreNames%> <%LogoURL%>
<%endloop%>
P.s: I think that you should use the 'queries' feature which is much faster than this way.
TheStone.
B.
As you mentioned that StoreID is not a primary key in 'stores' table, so you cannot use the 'queries' feature which is very useful for relational database.
In your case, you can create a global template which will get product's information:
sub {
my $tags = GT::Template->tags;
my $record = $tags->{results}[$tags->{row_num}-1];
my $store_id = $record->{StoreID};
my $info = $tags->{home}->{sql}->table('stores')->get({ StoreID => $store_id });
return %$info;
}
Change search_results.html like:
<%loop results%>
<%global_template_name%>
......<%StoreNames%> <%LogoURL%>
<%endloop%>
P.s: I think that you should use the 'queries' feature which is much faster than this way.
TheStone.
B.