I want to print the parent category name on a child category page
the current category name prints out like this
echo $this->category->category_name
but how do i get the parent category?
Hi
please try this code:
$q = 'SELECT `category_parent_id` FROM `#__virtuemart_category_categories` WHERE `category_child_id`=' . $this->category->virtuemart_category_id;
$db = JFactory::getDbo();
$db->setQuery($q);
$parentCategoryID = $db->loadResult();
if ($parentCategoryID != '0') {
$categoryModel = VmModel::getModel('category');
$parentCategory = $categoryModel->getCategory($parentCategoryID);
echo $parentCategory->category_name;
}
Regards,
Maik
thank you thank you thank you :)
thank you kkmediaproduction
this is help me but i have a problem
i i have a deep category like:
category1 -> subcategory1 -> subcategory2
in the page of subcategory2 i get the name of subcategory1
how can i get on subcategory2 the name of category1
kobi