function getCategories() { $orderCol = $this->state->get('list.ordering'); $orderDirn = $this->state->get('list.direction'); //echo $orderCol.' '.$orderDirn.'<br /><br />'; if (empty($this->_categories)) { if ($this->getState('filter.category') != '') { if ($this->getState('filter.category') == -1) { $cat_f = 0; } else { $cat_f = $this->getState('filter.category'); } $db = JFactory::getDBO(); $query = "SELECT c.*, cc.name as parent_name FROM #__djcf_categories c " . "LEFT JOIN #__djcf_categories cc ON c.parent_id=cc.id " . "WHERE c.parent_id=" . $cat_f . " ORDER BY c." . $orderCol . ' ' . $orderDirn; $db->setQuery($query); $this->_categories = $db->loadObjectList(); } else { if ($orderCol == 'ordering') { $orderCol = 'ord'; } $this->_categories = DJClassifiedsCategory::getCatAll(0, $orderCol, $orderDirn); } } return $this->_categories; }
function getCategories() { if (empty($this->_categories)) { if ($this->getState('filter.category') != '') { if ($this->getState('filter.category') == -1) { $cat_f = 0; } else { $cat_f = $this->getState('filter.category'); } $db = JFactory::getDBO(); $query = "SELECT c.*, cc.name as parent_name FROM #__djcf_categories c " . "LEFT JOIN #__djcf_categories cc ON c.parent_id=cc.id " . "WHERE c.parent_id=" . $cat_f . " ORDER BY c.ordering"; $db->setQuery($query); $this->_categories = $db->loadObjectList(); } else { $this->_categories = DJClassifiedsCategory::getCatAll(); } } return $this->_categories; }