Alex/Anyone,
Firstly - thank you for the solution. Here is the solution for anyone else that wants a different category for their parent and wants to use category.html for children categories.
# -------------------------------------------------------------------
# Returns the template set for a given category id.
#
my ($self, $id) = @_;
return unless ($id);
# If this category has a template set, use it.
my $cat_info = $self->get($id, 'HASH', 'Category_Template');
if ($cat_info->{Category_Template}) {
return $cat_info->{Category_Template};
}
# Otherwise look at it's parents.
# my $template = '';
# my $parents = $self->parents ($id);
# foreach my $parent (@$parents) {
# my $cat_info = $self->get($parent, 'HASH', 'Category_Template');
# if ($cat_info->{Category_Template}) {
# $template = $cat_info->{Category_Template};
# last;
# }
# }
# return $template;
}Thanks
Firstly - thank you for the solution. Here is the solution for anyone else that wants a different category for their parent and wants to use category.html for children categories.
Code:
sub _template_set { # -------------------------------------------------------------------
# Returns the template set for a given category id.
#
my ($self, $id) = @_;
return unless ($id);
# If this category has a template set, use it.
my $cat_info = $self->get($id, 'HASH', 'Category_Template');
if ($cat_info->{Category_Template}) {
return $cat_info->{Category_Template};
}
# Otherwise look at it's parents.
# my $template = '';
# my $parents = $self->parents ($id);
# foreach my $parent (@$parents) {
# my $cat_info = $self->get($parent, 'HASH', 'Category_Template');
# if ($cat_info->{Category_Template}) {
# $template = $cat_info->{Category_Template};
# last;
# }
# }
# return $template;
}