Page 1 of 1

Newbie question

Posted: Tue May 05, 2009 2:49 pm
by obiw1
I'm a real newbie, i have no PHP experience. I did work whit stuff like WordPress but never in the code.
I've a open source webshop where i like to expand the categories and sub categories. I think i found the place where the categories are generated. I understand a bit of the code but not enough

Code: Select all

<?php
class ModelCatalogCategory extends Model {
    public function getCategory($category_id) {
        $query = $this->db->query("SELECT DISTINCT * FROM category c LEFT JOIN category_description cd ON (c.category_id = cd.category_id) WHERE c.category_id = '" . (int)$category_id . "' AND cd.language_id = '" . (int)$this->language->getId() . "'");
        
        return $query->row;
    }
    
    public function getCategories($parent_id = 0) {
        $query = $this->db->query("SELECT * FROM category c LEFT JOIN category_description cd ON (c.category_id = cd.category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->language->getId() . "' ORDER BY c.sort_order");
 
        return $query->rows;
    }
                
    public function getTotalCategoriesByCategoryId($parent_id = 0) {
        $query = $this->db->query("SELECT COUNT(*) AS total FROM category WHERE parent_id = '" . (int)$parent_id . "'");
        
        return $query->row['total'];
    }
}
?>
Hope someone can help me

Re: Newbie question

Posted: Wed May 06, 2009 3:48 pm
by david64
Yes. It looks like you've got the right file, but what do you want to do?