Alex,
As I explained a couple of postings above - that doesn't work
There must be something else I need to do, I was hoping you would know
JeffB.
My sub_template now looks like this...
# -------------------------------------------------------------------
# Return the value of template set to use for a given category.
#
my $self = shift;
my $id = shift or return $self->error ('BADARGS', 'FATAL', "Must pass category id to template_set");
return '' unless (exists $self->{schema}->{cols}->{Category_Template});
return $self->{_template_cache}->{$id} if (exists $self->{_template_cache}->{$id});
# If this category has a template set, use it.
my ($cat_info) = $self->select ( ['Category_Template'], { ID => $id })->fetchrow_array;
# Otherwise look at it's parents.
# unless ($cat_info) {
# my $parents = $self->parents ($id);
# foreach my $parent (@$parents) {
# ($cat_info) = $self->select ( ['Category_Template'], { ID => $parent })->fetchrow_array;
# if ($cat_info) {
# last;
# }
# }
# }
$self->{_template_cache}->{$id} = $cat_info || '';
return $self->{_template_cache}->{$id};
}
JeffB
GT customer for 6 years (and counting!)
As I explained a couple of postings above - that doesn't work
There must be something else I need to do, I was hoping you would know
JeffB.
My sub_template now looks like this...
Code:
sub template_set { # -------------------------------------------------------------------
# Return the value of template set to use for a given category.
#
my $self = shift;
my $id = shift or return $self->error ('BADARGS', 'FATAL', "Must pass category id to template_set");
return '' unless (exists $self->{schema}->{cols}->{Category_Template});
return $self->{_template_cache}->{$id} if (exists $self->{_template_cache}->{$id});
# If this category has a template set, use it.
my ($cat_info) = $self->select ( ['Category_Template'], { ID => $id })->fetchrow_array;
# Otherwise look at it's parents.
# unless ($cat_info) {
# my $parents = $self->parents ($id);
# foreach my $parent (@$parents) {
# ($cat_info) = $self->select ( ['Category_Template'], { ID => $parent })->fetchrow_array;
# if ($cat_info) {
# last;
# }
# }
# }
$self->{_template_cache}->{$id} = $cat_info || '';
return $self->{_template_cache}->{$id};
}
JeffB
GT customer for 6 years (and counting!)