/** * This public function return array of parent hirarchey childcat-....>topCat * * @param integer $catid cat id. * @param string $extension extension. * * @since 2.2 * @return integer. */ public function getCatParents($catid, $extension = 'com_quick2cart') { $parentCats = array(); $db = JFactory::getDBO(); $storehelper = new storeHelper(); do { $category = ''; $category = $storehelper->getCatDetail($catid, $extension); if (!empty($category) && !empty($category['parent_id'])) { $parentCats[] = $category; // Shift to parent catid $catid = $category['parent_id']; } else { break; } } while (!empty($category)); return $parentCats; }