How to get a category listing from Magento?

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2009-03-03T01:09:33Z Indexed on 2010/04/03 11:43 UTC
Read the original article Hit count: 183

Filed under:
|
|

I want to create a page in Magento that shows a visual representation of the categories.. example

CATEGORY
 product 1
 product 2

ANOTHER CATEGORY
 product 3

My problem is, their database is organised very differently to what I've seen in the past. They have tables dedicated to data types like varchar, int, etc. I assume this is for performance or similiar.

I haven't found a way to use MySQL to query the database and get a list of categories. I'd then like to match these categories to products, to get a listing of products for each category. Unfortunately Magento seems to make this very difficult.

Also I have not found a method that will work from within a page block.. I have created showcase.phtml and put it in the XML layout and it displays and runs it's PHP code. I was hoping for something easy like looping through $this->getAllCategories(); and then a nested loop inside with something like $category->getChildProducts();

Can anyone help me? Thank you!

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql