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

SOLVED: Almost there - categories on homepage working but images aren’t showing up
 
Weezers Gifts
Member
 
Total Posts:  71
Joined:  2008-11-08
PA
 
dannyswine - 26 November 2008 06:13 PM

Thanks for the help.....

I have tried both with and without the <div> tags, neither seems to work.  I’ve added plain text into the box to make sure that’s working, and it is.....  Guess we’ll see!  Man, this is a whole lot more work than I ever expected.

NP Thats all I can think off, lol.  Yeah one of the other peeps here maybe able to help ya.

Trust me I have tried many different cart programs for various things and once you get this setup you won’t go back to anything else.  I am still learning and it is a HUGE learning curve, but it has so much to offer and it is well worth it in the long run.

Stick with it and hang tight.  It will come to ya wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
Weezers Gifts
Member
 
Total Posts:  71
Joined:  2008-11-08
PA
 

After reading this thread again, look at page 3 post #32, will be second post down.  Did you do that

->addAttributeToSelect('image')

to the app\code\core\Mage\Catalog\Block\Navigation.php so it looks like this:

$collection->addAttributeToSelect('url_key')
            ->
addAttributeToSelect('name')
            ->
addAttributeToSelect('is_anchor')
            ->
addAttributeToSelect('image')
            ->
addAttributeToFilter('is_active'1)
            ->
addIdFilter($category->getChildren())
            ->
setOrder('position''ASC')
            ->
joinUrlRewrite()
            ->
load();

Just checking on everything that I can think of.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dannyswine
Jr. Member
 
Total Posts:  17
Joined:  2008-11-20
 

Thanks again!  As it turns out, the problem was that, for some reason or another, I didn’t have my store’s default category assigned!  Grrrr!

Thanks for the help with the images as well - once I finally got the categories showing, had to set up the code for the images as well.  Yay!  It’s finally working!

I haven’t worked with many other ecommerce applications, but I sure am learning a lot from this one.....  It’s been a long time since I’ve done such in-depth work and I’m loving it despite all the little frustrations I’ve encountered.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Weezers Gifts
Member
 
Total Posts:  71
Joined:  2008-11-08
PA
 

Not a problem, glad to help and give back what I have learned.

Glad to see you got everything working now. 

Well I worked with some of the free ones and they were lacking alot of stuff as well as support in the forums.  I stumbled across Magento and getting past all the little frustrations is the hard part, but you learn as you go.  I as well love getting into the code stuff, so much to learn.  But worth it.

Have Fun wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
robbo23
Sr. Member
 
Total Posts:  81
Joined:  2008-10-20
 

I followed brendan’s instructions from post #28 and it works beautifully (thanks brendan grin )

I’m wondering if anyone knows how to get these sub-categories to display in multiple columns rather than just one?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scabro
Jr. Member
 
Total Posts:  16
Joined:  2008-11-28
 

Hi guys,

I’ve managed to use these instructions to display sub categories on the main category pages as linked images.
Now I’ve got a problem where I need to remove list of products from the main category pages and only display relevant products of the sub category when clicked on the sub category image.

Have a look at the website which I’m currently working on and where I’m trying to integrate it: http://www.bettyandchickens.com/kitchen-products
As you can see there - two sub categories are displayed on the main category pages, but I need to remove the list of products from the main categories and only display them on sub category pages.

Any help would be greatly appreciated.

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

hey Scabro

The example you gave doesnt have any products attached..???

Do you mean one of your other categories? http://www.bettyandchickens.com/living-room-products ??

If so. Wouldnt you just go into the category Page and change the “Display Mode” to Static Block?

Nice looking site BTW

brendan

Image Attachments
block.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
Scabro
Jr. Member
 
Total Posts:  16
Joined:  2008-11-28
 

Hi Brendan,

Thanks for the info.
I’ve just changed it - as the project is about to be finished and client asked for this small change.
What I’ve done was simply to duplicate the “default” folder with the content in the “app” folder, renamed it to “default2” and from the “catalog_category_default” section of the layout/catalog.xml file I’ve removed the following:

<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml"
                    <
block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        <!-- 
The following code shows how to set your own pager increments -->
                        <!--
                            <
action method="setDefaultListPerPage"><limit>4</limit></action>
                            <
action method="setDefaultGridPerPage"><limit>9</limit></action>
                            <
action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
                            <
action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
                            <
action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
                            <
action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
                            <
action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
                        -->
                    </
block>
                    <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </
block>

Then in the Category section of the Control Panel, in the Custom Design tab I’ve chosen the “default2” from the Custom Design menu.
It’s obviously not the best option but it did the job.

This way I simply removed products all together - and have just sub categories displayed on the main category pages.

I’ve tried to use the Static Block as you’ve explained, but for some reason it didn’t want to work for me - that’s why I’ve decided to use this option.

Thanks anyway for looking into it - much appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rtgr
Jr. Member
 
Total Posts:  12
Joined:  2008-11-19
 
dan_w - 14 November 2008 02:04 PM

brendan,
Here’s the changes that you can make to use a secondary image along with a main category image. First, run this sql statement on your db. I should say, as always, anyone who attempts this, backup your stuff before proceeding. I’ve attached the sql as a txt file as well just in case the forum shifts/converts some apostrophes to quotes or vice versa.

INSERT INTO `eav_attribute` (`attribute_id`, `entity_type_id`, `attribute_code`, `attribute_model`, `backend_model`, `backend_type`, `backend_table`, `frontend_model`, `frontend_input`, `frontend_label`, `frontend_class`, `source_model`, `is_global`, `is_visible`, `is_required`, `is_user_defined`, `default_value`, `is_searchable`, `is_filterable`, `is_comparable`, `is_visible_on_front`, `is_unique`, `is_configurable`, `apply_to`, `position`, `note`, `is_visible_in_advanced_search`, `is_used_for_price_rules`) VALUES
(’’, 3, ‘secondimage’, ‘’, ‘catalog/category_attribute_backend_image’, ‘varchar’, NULL, NULL, ‘image’, ‘Secondary Image’, NULL, NULL, 0, 1, 0, 0, NULL, 0, 0, 0, 0, 0, 1, ‘’, 1, ‘’, 0, 1);

.....

Dan

Is this still working in version 1.2.0.1?
I executed the sql, the new row is there, but I don’t get an extra field in the admin section

Maybe som extra code has to be added for newer versions?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pixxa
Sr. Member
 
Total Posts:  275
Joined:  2008-10-23
 
brendan. - 12 January 2009 09:26 AM

hey Scabro

The example you gave doesnt have any products attached..???

Do you mean one of your other categories? http://www.bettyandchickens.com/living-room-products ??

If so. Wouldnt you just go into the category Page and change the “Display Mode” to Static Block?

Nice looking site BTW

brendan

Somehow this doenst work for me as well, domain.com shows the sub-categories images and the products when i set the ‘soap’ categorie to anchor = yes. If i change it to anchor = no it tells me that there are no products in this categorie but still shows me the images of the sub-categories.

Can someone at wich the above is working post me their “/app/design/frontend/default/default/template/catalog/categories/view.phtml” code?

Im on 1.2.0.2 btw.

 
Magento Community Magento Community
Magento Community
Magento Community
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

So the code for displaying the child categories through a static block works except I have a cache issue where if I only have 1 child category the cache keeps the current category and redisplays it in the subcategory.  Please see the attached code and image file.

<?php $_maincategorylisting=$this->getCurrentCategory()?>                        
<?php $_categories
=$this->getCurrentChildCategories()?>
<?php 
if($_categories->count()):?>
    
<div class="listing-type-list catalog-listing">
    
    
<?php $_iterator 0?>
    <? 
foreach ($_categories as $_category):?>
        <? 
if($_category->getIsActive()): ?>
            <?php $cur_category
=Mage::getModel('catalog/category')->load($_category->getId()); ?>
            <?php $layer 
Mage::getSingleton('catalog/layer'); ?>
            <?php $layer
->setCurrentCategory($cur_category); ?>  
              
<div class="listing-item<?php if( ++$_iterator == sizeof($_categories) ): ?> last<?php endif; ?>">
            
<? if($_imageUrl=$this->getCurrentCategory()->getImageUrl()):?>
                <?php 
// Category Image ?>
                    
<div class="product-image">
                        <
a href="<?php echo $this->getCategoryUrl($_category) ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                            <
img src="<?php echo $_imageUrl ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
                        </
a>
                    </
div>
            
<?php elseif($_googleMap=$cur_category->getData('map_image_url')): ?>
                    
<div class="product-image">
                        <
a href="<?php echo $this->getCategoryUrl($_category) ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                            <
img style="width:135px;height:135px;" border="0" src="<?php echo $_googleMap ?>" alt="<?php echo $_category->getName() ?>">
                        </
a>
                    </
div>
              
<? endif; ?>
                <?php 
// category description ?>
                
<div class="product-shop">
                <
h5><a href="<?php echo $this->getCategoryUrl($_category) ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>"><?php echo $this->htmlEscape($_category->getName())?></a></h5>
                <
div class="clear"></div>
                <
div class="description">
                    
<?php echo nl2br($this->getCurrentCategory()->getDescription()) ?>
                
</div>
                
                </
div>
            </
div>
        
<? endif; ?>
    <?php 
endforeach; ?>
    
</div>
            
<? endif; ?>
Image Attachments
Picture 3.pngPicture 4.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
Azim
Sr. Member
 
Total Posts:  97
Joined:  2008-09-17
NY, USA
 

Hello,
little help please.
I got it worked to shows sub-ccategory but it wont show the description for the sub-cat even though i have added the description in the back end.
And is it possible to show two categories per row and with images and description.
I set the same block for my home page and it shows the main categories and sub-cat when clicked on the main, so far good.
Has anybody got two products per row, if have please share the code.

 
Magento Community Magento Community
Magento Community
Magento Community
 
theallgreenstore
Member
 
Total Posts:  33
Joined:  2009-01-08
 

Has anyone been able to do this in a grid view instead of a list?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ionaudiovisual
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2007-12-24
 

I’m a complete newbie, but have managed to customize my site thanks to the forums and wiki. I want the categories on the homepage and even after following the instructions in this topic but im getting this error

Parse error: syntax error, unexpected T_ENDIF in /home3/ionaudio/public_html/app/design/frontend/default/ion/template/catalog/category/list.phtml on line 1

What am i doing wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adam Moss
Sr. Member
 
Avatar
Total Posts:  248
Joined:  2009-02-11
Birmingham, UK
 
theallgreenstore - 21 January 2009 06:14 PM

Has anyone been able to do this in a grid view instead of a list?

I modified it like this:

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

    <?php 
foreach ($_categories as $_category): ?>
   
<div class="categorylisting">
            
<?php if($_category->getIsActive()): ?>
                
<div class="product-image">
                            <
a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                                <
img src="<?php echo $_category->getImageUrl() ?>" width="140" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
                            </
a>
                                
<?php /* echo "Find this item->" */ ?>
                        
</div>
                        <
h2><a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a></h2>
                        
<?php echo $_category->getDescription() ?>
              
            <?php 
endif; ?>
        
</div>
    
<?php endforeach; ?>

And create this style in your stylesheet:

.categorylisting {
    float
:left
    
width:165px
    
padding:10px;
    
border:1px solid #ccc;
    
margin:10px;
    
text-align:left;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top