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 blocks on home page? 
 
cshontz
Sr. Member
 
Avatar
Total Posts:  91
Joined:  2007-11-07
 

My apologies if this has come up before - I’m still trying to wrap my head around Magento customization. Is it possible to configure root-level category blocks to appear on the home page? Each category block would contain a jpg, and possibly name and description text. Clicking on each block would go to the appropriate sub-page.

Is there a another forum thread or tutorial that explains this?

Please refer to the attached jpg.

Image Attachments
magento_layout.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
alistek
Sr. Member
 
Total Posts:  293
Joined:  2008-04-02
Normal, IL
 

Sure, there are a few ways to do this but the easiest that I would think of is to use a combination of static blocks and layout files.  If I were to do this, I would create a static block underneath the CMS->Manage Static Blocks menu and add the images that I wanted and the linking text, i.e. <a href="www.example.com/category1/><img src="category1.jpg" /></a>.  After that you would find the layout XML file that contains where you would like to put the block.

Say we want to put it on the homepage and we are using the the 3columns.phtml template.

Using page.xml:

<reference name="left">
            <
block type="cms/block" name="cms_category1">
                <
action method="setBlockId"><block_id>category1</block_id></action>
            </
block>
</
reference>

This is assuming that when you made the new Static Block you put the identifier as “category1”.

For more info please refer to thread:
http://www.magentocommerce.com/boards/viewthread/5936/

-Adam

 
Magento Community Magento Community
Magento Community
Magento Community
 
cshontz
Sr. Member
 
Avatar
Total Posts:  91
Joined:  2007-11-07
 

Thanks for the very helpful replies, Adam. Using your advice, I am able to produce the results I’m looking for - however, I’m not quite sure how to make it so the static blocks appear only on the home page.

I understand how to get static blocks to appear in only certain sections, per your example in the other thread, but I’m not aware of a section name (handle?) that refers explicitly to the home page.

Update 1: Okay, I think I figured it out. I simply went to “CMS -> Manage Pages -> Home Page” in the admin, selected “Custom Design” from the left, and added your static block reference code to “Layout Update XML”. As a result, my static block appears in the proper column, only on the home page. However, it comes after the newsletter sign-up - I’m assuming I can change its position.

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