Hi Guys,
I am trying to add the category and child category programmatically, but am not sure of the variable for the child category. I have the code below, however after .$category->category_name I would then like to add the subcategory name if it is a sub category and if there is no subcategory remove the .$category->category_name completely.
$document->setTitle("Buy Womens and Mens Clothing".$category->category_name);
if ($this->app->getCfg('MetaTitle') == '1') {
$document->setMetaData('title', $title);
}
Can any one advise how i can achieve this?
Best Regards
Donna
you can have multiple child cats
you can do something like
$html_title = "Buy Womens and Mens Clothing ".$category->category_name;
if ($this->category->haschildren) {
foreach ( $this->category->children as $subcategory ) {
$html_title = $html_title.' '.$subcategory->->category_name
}
}
$document->setTitle($html_title);