Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Category Listing
 
[db] DigitalBlueprint
Member
 
Avatar
Total Posts:  37
Joined:  2007-10-11
Eastbourne, UK
 

Hi,

I am attempting to get my head around the Magento templating system and I’m running into a number of problems.

The first thing that I want to be able to do is on the catalog homepage (not the cms homepage) to display the top-level categories with their images and titles. To start off testing this I cleared the app/design/frontend/default/littlebedroom/template/catalog/home.phtml file and replaced it with the following code:

<div class="home-spot">
    <
h1>Product Categories</h1>
    <
ul>
        
<?foreach ($this->getStoreCategories(1) as $_category):?>
            
<li>Test</li>
        
<?endforeach?>
    
</ul>
</
div>

I have purposefully kept this as simple as possible in order that I can start from the very basics and learn as I increase the functionality. However, even at this stage I am getting errors! When I now go to the catalog homepage I receive the following error (application trace and full path details excluded):

WarningInvalid argument supplied for foreach() in .../app/design/frontend/default/littlebedroom/template/catalog/home.phtml on line 4

Now, I am assuming that to achieve what I want I will also have to edit the layout/main.xml file in my theme, but I have no idea how this file works!

If anyone could provide some pointers on where I have gone wrong, or what else I need to edit then I would be very extremely grateful. Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
[db] DigitalBlueprint
Member
 
Avatar
Total Posts:  37
Joined:  2007-10-11
Eastbourne, UK
 

Hi ohminu,

I’ve attached a quick jpeg of a very bland design version of what I’m trying to achieve. I’ve manage to get my around the xml files and templates enough to get my left-hand vertical menu working now so I think I’ll give this another go tomorrow, although any advice that could help get things going quickly would be helpful.

Thanks.

Image Attachments
category-listing.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Check this thread out: http://www.magentocommerce.com/boards/viewthread/666/

 
Magento Community Magento Community
Magento Community
Magento Community
 
[db] DigitalBlueprint
Member
 
Avatar
Total Posts:  37
Joined:  2007-10-11
Eastbourne, UK
 

Hi Moshe,

Thanks for the link. I had already seen that thread, but would appear that the theme system has been updated since those first posts that detailed how to set it up.

In any case, the bit I am having trouble with at the moment is simply getting the “foreach ($this->getStoreCategories(1) as $_category)” code not to error out, I’m assuming that there needs to be some additional code in the main.xml file, but I have no idea what that is or where it should go!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top