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

Page 2 of 12
SOLVED: Almost there - categories on homepage working but images aren’t showing up
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

ok,

where is this file located?

Mine is currently in: app/design/frontend/default/(your theme)/template/catalog/category/list.phtml

 
Magento Community Magento Community
Magento Community
Magento Community
 
davinder
Member
 
Total Posts:  56
Joined:  2008-06-26
 

this is where mine is :/app/design/frontend/default/default/template/catalog/category which looks same as yours

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

ok

where are you calling the code from?:
in Admin/Cms

In the “Home Page” Template do you have

{{block type="catalog/navigation" name="catalog.category" template="catalog/category/list.phtml"}}

in the content field?

 
Magento Community Magento Community
Magento Community
Magento Community
 
davinder
Member
 
Total Posts:  56
Joined:  2008-06-26
 

silly me, i was adding the code above in custom design instead of content area. Now it works fine. Thanks for your help brendan!

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

no worries;

also here is some code that extends this to give you the head category and its child categories

might be handy

cheers

<?php foreach ($this->getStoreCategories() as $_category): ?>

    <?php $open 
$this->isCategoryActive($_category); ?>

        <?php
                $cur_category
=Mage::getModel('catalog/category')->load($_category->getId());
                
$layer Mage::getSingleton('catalog/layer');
                
$layer->setCurrentCategory($cur_category);
                
        if (
$immagine $this->getCurrentCategory()->getImageUrl()): ?>     
            
            
<table class="hometable" border="0" cellspacing="0" >
                <
tr>
                <
td class="header" colspan="4"><h4><?php echo $_category->getName()?></h4></td>
                </
tr>
                <
tr>
                <
td class="headerimg" colspan="4">
                    <
p>
                            <
a href="<?php echo $this->getCategoryUrl($_category) ?>">
                            <
img src="<?php echo $immagine ?>" border="1" style="border: 1px #DDDDDD solid;" alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()) ?>" width="600" height="100" />
                            </
a>
                    </
p>
                </
td>
                <
tr>
                    
<?php $i=0; foreach ($this->getChildCategories($cur_category) as $_childCategory): ?>
                        
                        <?php 
if ($i>3): continue; endif; ?>
                            
<td>
                                <
h5><?php echo $_childCategory->getName() ?></h5>
                                <
a href="<?php echo $this->getCategoryUrl($_childCategory) ?>"<?php if ($this->isCategoryActive($_childCategory)): ?><?php endif ?>>
                                <
img src="<?php echo $_childCategory->getImageUrl() ?>" alt="<?php echo $_childCategory->getName() ?>" width="75"/>
                                </
a>
                            </
td>
                        
<?php $i++; endforeach; ?>                        
                
</tr>
                
                <
p>
            </
table>
            
        
<?php endif; ?>
        
<?php 
endforeach; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
davinder
Member
 
Total Posts:  56
Joined:  2008-06-26
 

Thanks Brandon!

 
Magento Community Magento Community
Magento Community
Magento Community
 
davinder
Member
 
Total Posts:  56
Joined:  2008-06-26
 

Just a Note: To show the right size of category images on product pages I had to delete width="475" from everywhere in view.html page.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

simple way is to just add a height size setting for the image. this will stop it from scaling across the page which kinda sucks! grin

looking at your shop, looks like ur setting up for jewerly?

might want to check out these themes,. I think they have a jewelry theme??.

http://www.ecommerce-themes.com/

also try these guys. I bought their greyline theme, its working ok on a shop im putting together
http://www.magentocommerce.com/extension/516/greyline-template

its just a little tricked out which i like. They also have some interesting extensions also. Might be handy on a shop like your doing!

Note: I dont have anything to do with the above suggestions. But out of the box it might be better to spend a few dollars than starting from the default theme. Nothing against the default theme. I just wanted something a little different than the standard supplied themes

cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
davinder
Member
 
Total Posts:  56
Joined:  2008-06-26
 

Thanks for those links Brendan. I liked the grey-line template. All the templates I have looked until now they have horizontal navigation on the top which limits the amount of top level categories you can have. I used the default theme and changed the navigation to vertical.

I got another question not related to above issue of showing categories on home page though. Take a look at this page http://test.newagestyles.com/bracelet, is there any way I can move the breadcrumbs so that it shows under the title of category instead of top left corner above the navigation?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

no really dont know

except look in the page.xml file ~line 65 it has details about breadcrumbs

you could take that code and put it into the catalog.xml file around line ~81

might at least be a staring point

 
Magento Community Magento Community
Magento Community
Magento Community
 
pldtm
Sr. Member
 
Avatar
Total Posts:  82
Joined:  2007-09-04
Bordeaux, France
 

I’m trying to have it working, but nothing appears on homepage.

The list.phtml file was created in catalog/category, and in my homepage cms i added a div with {{block type="catalog/navigation" name="catalog.category" template="catalog/category/list.phtml"}} inside.

I tried to change the type navigation by product,but made an error.

this is what’s in my homepage cms : <div style="width:100%">{{block type="catalog/navigation" name="catalog.category" template="catalog/category/list.phtml"}}</div>

is here is what’s firebug shows : <div style="width: 100%;"> </div>

where is my error.

thanks for help

phil

 
Magento Community Magento Community
Magento Community
Magento Community
 
cathyka
Member
 
Total Posts:  62
Joined:  2008-04-03
 

I am trying to get all the subcategory images to display on the category page. I think this is right thread but I just can’t seem to get it to work.
First I create a phtml file using the above code and placed it in /app/design/frontend/default/MY_TEMP/template/catalog/category/photolist.phtml>

<?php

<?php
/**
 * Category view template
 *
 * @see Mage_Catalog_Block_Category_View
 */
?>


<?php 
foreach ($this->getStoreCategories() as $_category): ?>

    <?php $open 
$this->isCategoryActive($_category); ?>

        <?php
                $cur_category
=Mage::getModel('catalog/category')->load($_category->getId());
                
$layer Mage::getSingleton('catalog/layer');
                
$layer->setCurrentCategory($cur_category);
                
        if (
$immagine $this->getCurrentCategory()->getImageUrl()): ?>     
            
            
<table class="hometable" border="0" cellspacing="0" >
                <
tr>
                <
td class="header" colspan="4"><h4><?php echo $_category->getName()?></h4></td>
                </
tr>
                <
tr>
                <
td class="headerimg" colspan="4">
                    <
p>
                            <
a href="<?php echo $this->getCategoryUrl($_category) ?>">
                            <
img src="<?php echo $immagine ?>" border="1" style="border: 1px #DDDDDD solid;" alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()) ?>" width="600" height="100" />
                            </
a>
                    </
p>
                </
td>
                <
tr>
                    
<?php $i=0; foreach ($this->getChildCategories($cur_category) as $_childCategory): ?>
                        
                        <?php 
if ($i>3): continue; endif; ?>
                            
<td>
                                <
h5><?php echo $_childCategory->getName() ?></h5>
                                <
a href="<?php echo $this->getCategoryUrl($_childCategory) ?>"<?php if ($this->isCategoryActive($_childCategory)): ?><?php endif ?>>
                                <
img src="<?php echo $_childCategory->getImageUrl() ?>" alt="<?php echo $_childCategory->getName() ?>" width="75"/>
                                </
a>
                            </
td>
                        
<?php $i++; endforeach; ?>                        
                
</tr>
                
                <
p>
            </
table>
            
        
<?php endif; ?>
        
<?php 
endforeach; ?>

Then I created a static block. “Categories Images”

{{block type="catalog/navigation" name="catalog.category" template="catalog/category/photolist.phtml"}}

Then I went into the catalog>manage categories
and called the block by selecting “static block only” and selected the block.

I think I need to add the block to an xml file but I just don’t know which one? Because it is not working.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

hi cathy,

ok this code is used to return the categories onto the home page.

If i understand you correctly you want to have the subcategories returned when your on a category page?

ok try this

1. In cms select Static Pages
a. Set the Block Identifyer to for example “Sub Category Listing”
b. Set the Identifyer to “subcategory_listing”
c. In the content section add “{{block type="catalog/navigation" template="catalog/navigation/subcategory_listing.phtml"}}"

2. Now take this code and create a new file called for example “subcategory_listing.phtml” this file needs to live in the “catalog/navigation” directory

<?php $_categories=$this->getCurrentChildCategories(); ?>

<div class="listing-type-list catalog-listing">
    
<?php foreach ($_categories as $_category): ?>
    
<table width="100%" border="0" cellspacing="0" cellpadding="0">
            
<?php if($_category->getIsActive()): ?>
            
<tr>
                <
td width="30%">
                    <
div class="listing-item">
                        <
div class="cat-box-text">
                        <
h6><a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a></h6>
                        </
div>
                        <
div class="product-image">
                            <
a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                                <
img src="<?php echo $_category->getImageUrl() ?>" width="100" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
                            </
a>
                                
<?php /* echo "Find this item->" */ ?>
                        
</div>
                    </
div>
                
                </
td>
                <
td width="40%">
                    <
div class="listing-item">
                        <
div class="cat-box-text">
                        
<?php echo $_category->getDescription() ?>
                        
</div>
                    </
div>
                </
td>
            
<?php endif; ?>
            
</tr>
        </
table>
    
<?php endforeach; ?>
</div>

3. Now Goto Manage Categories.
a. Pick a Sub Category Entry
b. Set the display mode to “Static Block Only”
c. From the CMS Block dropdown select the Static Page “Sub Category Listing”
d. Set the is anchor to no

ive just set a site live you can see this in action http://www.getstuff.com.au

hth
Brendan

 
Magento Community Magento Community
Magento Community
Magento Community
 
cathyka
Member
 
Total Posts:  62
Joined:  2008-04-03
 

Thanks for your help brendan. It is late here, so I am going to look at your suggestions more closely tomorrow. But I tried it and it didn’t work.

I am trying to show all the images from the subcategories of a category in the category link.
example

Green Category
-Lime Sub (Has 3 products)
-Peppermint Sub(5)
-Evergreen Sub(2)

When I click on the Green Category in the menu, I wish to see

Lime Sub Header
3 product Images

Peppermint Sub Header
5 product Images

Evergreen Sub Header
2 product images

I don’t wish to change the way the subcategory pages are currently listing.
These pages now show all the images in those sub categories as a list.

Did that make sense? I am sorry, It is hard to describe with words but your link did kind of visually show what I was looking for.

thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cathyka
Member
 
Total Posts:  62
Joined:  2008-04-03
 

Hi brendan, I took a closer look and I completely understand what your code is doing and why I am seeing what I am seeing.

If I apply it to the main category “Green”
If I had a subcategory image, it would show that because it is also showing the alt title.
Then I see a list of all the sub categories. “Lime” “Peppermint” “Evergreen”
What I don’t see are all the products under each of the subcategories.

In your code you have a line that is commented out.

<?php /* echo "Find this item->" */ ?>
What is this for?
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 12