I have a dropdown menu that has categories three levels deep. At the end of each dropdown column, I have a "view all" link, which I'd like to lead users to a page similar to this page:

Categories list example

Clicking on Main Category name leads you to Category landing page with a static block, whereas the "view all" linked page should contain a list of links to all categories within the main category on the dropdown.

I've edited "app/code/local/mage/page/block/html/Topmenu.php" on line 126 to contain this anchor tag:

$html .= '<a href="' . $child->getUrl() . '" class="viewAllLink"><span>View All</span></a>';

I've been trying to make this happen for the past couple of days and I'm very stumped. I'm also wondering if this can be accomplished through phtml files. Is this possible? Can anyone please provide me with direction as how to create functionality like this?


A while back I worked on an extension that shows children categories when viewing a category. The code might help you to come up with the solution to your question.

You can find the extension on Github, it's a bit beta, especially on the frontend (list) part.

| improve this answer | |
  • Hi, very cool extension, thanks for the answer. How could I show something similar to this; ex: Show all categories under category ID 49 on a CMS page? – joshSpiderb Dec 18 '13 at 23:53
  • On a CMS page this might be quite tricky. Better of using a normal category page and display both products AND static block so you can add content. – Sander Mangel Dec 19 '13 at 11:02

Here is small Suggession:

ini_set('max_execution_time', 0);
ini_set('display_errors', 1);
$mageFilename = MAGE_FILE_URL_STAGING;

require_once $mageFilename;


function get_categories(){
$i = 0; 
$category = Mage::getModel('catalog/category'); 
$tree = $category->getTreeModel(); 
$ids = $tree->getCollection()->getAllIds(); 
$arr = array();
if ($ids){ 
foreach ($ids as $id){ 
$category = Mage::getModel('catalog/category'); 
$categorydata = array (
            'name' => htmlspecialchars($category->getName(),ENT_QUOTES),
            'categorydes' => htmlspecialchars($category->getDescription(),ENT_QUOTES),              
            'image' => $category->getImageUrl(),
            'metakeywords' => htmlspecialchars($category->getmeta_keywords(),ENT_QUOTES),
            'metadescrption' => htmlspecialchars($category->getmeta_description(),ENT_QUOTES),
            'magento_category_id' => $category->getId(),
            'magento_cat_spenish_id' => $category->getId(),
            'spanish_name' => htmlspecialchars($category->getName(),ENT_QUOTES),
            'parent_id' => $category->getparentId(),
            'images' => $category->getImageUrl()
echo "<pre>";
echo "<pre>";
$add = add_categories($categorydata);
$i = $i+1;
return $arr;


$arr =  get_categories();

function add_categories($parentid)
    // echo "INSIDE CATEGORY<br>";
    $query  = "INSERT INTO `categories` (`id`, `name`, `categorydes`, `image`, `metakeywords`, `metadescrption`, `magentoparentid`, `magento_category_id`, `magento_cat_spenish_id`, `spanish_name`, `updatedateandtime`, `status`)
    mysql_query($query)  or die(mysql_error());
    // echo $parentid['image']."<br>";
    // if($parentid['image'] != "")
    // $imagecopy = copyimgto_local($parentid['image']);

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.