uri->total_segments(); $cat_url_title = ee()->uri->segment($total_segments); // 2. Initialize Variables (Defaults) $current_id = 0; $display_name = ucfirst($cat_url_title); // Fallback name $has_children = false; $cat_marketing_desc = ""; // 3. Query the Database to find the Category ID if (!empty($cat_url_title)) { $query = ee()->db->select('cat_id, cat_name, cat_description') ->from('categories') ->where('cat_url_title', $cat_url_title) ->get(); if ($query->num_rows() > 0) { $row = $query->row(); $current_id = $row->cat_id; $display_name = $row->cat_name; $cat_marketing_desc = $row->cat_description; // 4. Check if this category has sub-categories (Children) $child_check = ee()->db->select('cat_id') ->from('categories') ->where('parent_id', $current_id) ->get(); if ($child_check->num_rows() > 0) { $has_children = true; } } } ?> <?php echo $display_name; ?> | Results

Find 'Electronics' you want for In home Portable Products

Product Catalog

No products found in the catalog.
Advertising Space
Advertising Space
Advertising Space