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

How do I post catalogs on the front page? 
 
j45on
Jr. Member
 
Total Posts:  10
Joined:  2008-05-12
 

How do I post catalogs on the front page?

I have created two products in category 1 but it does not appear in the front page. Did I miss anything?

 
Magento Community Magento Community
Magento Community
Magento Community
 
corbykissler
Member
 
Total Posts:  39
Joined:  2008-05-14
 

It seems they have left this out of the product - there are tons of code examples for pushing categories to different pages.

Search under category or subcategory . . .

Here’s some code I used to push out subcategories .. 

<?php $_maincategorylisting=$this->getCurrentCategory()?>                        
<?php $_categories
=$this->getCurrentChildCategories()?>
<?php 
if($_categories->count()):?>
           <? 
foreach ($_categories as $_category):?>
                      
                        <? 
if($_category->getIsActive()):
                        
                        
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
           
$layer Mage::getSingleton('catalog/layer');
           
$layer->setCurrentCategory($cur_category);  
           if(
$_imageUrl=$this->getCurrentCategory()->getImageUrl()):?>
            
                        
<div><div class="linkimage"><p>
<
a href="<?php echo $this->getCategoryUrl($_category)?>"><img src="<?php echo $_imageUrl?>"></a></p></div><p><a href="<?php echo $this->getCategoryUrl($_category)?>"><?php echo $_category->getName()?></a></p></div>
<?                                              
                 
                 
                 
else: ?>
                 
                 
<div><p><a href="<?php echo $this->getCategoryUrl($_category)?>"><?php echo $_category->getName()?></a></p></div>


<?
                 
                 
                 
                        
endif;
 
Magento Community Magento Community
Magento Community
Magento Community
 
corbykissler
Member
 
Total Posts:  39
Joined:  2008-05-14
 

This one will print out all the main categories for the store . .

/* Get the categories that are active for the store */
$_main_categories=$this->getStoreCategories();
$_current_category=$this->getCurrentCategory();

?>
<ul>
<?php 
    
    
foreach ($_main_categories as $_main_category):
      if(
$_main_category->getIsActive()):                             
           
$cur_category=Mage::getModel('catalog/category')->load($_main_category->getId());
           
$layer Mage::getSingleton('catalog/layer');
           
$layer->setCurrentCategory($cur_category);     

/* Write the main categories */           
?>                
<li><a href="<?php echo $this->getCurrentCategory()->getUrl()?>"><?php echo $this->getCurrentCategory()->getName();?></a></li>   


<?php 

/* Check the category variable loop against the current category path if it is - print sub categories */
if (in_array($this->getCurrentCategory()->getId(), $_categorypath)): ?>
<?php $_maincategorylisting
=$this->getCurrentCategory()?>                        
<?php $_categories
=$this->getCurrentChildCategories()?>
<?php 
if($_categories->count()):?>

<ul>
<? foreach ($_categories as $_category):?>                    
   <? 
if($_category->getIsActive()):                    
           
$cur_subcategory=Mage::getModel('catalog/category')->load($_category->getId());
           
$layer Mage::getSingleton('catalog/layer');
           
$layer->setCurrentCategory($cur_subcategory);  
          
?>                          
<li><a href="<?php echo $this->getCategoryUrl($_category)?>"<?php echo $_category->getName()?></a></li>
    
<? endif;?>
<?endforeach?>
</ul>            
<?php /* This resets the category back to the original pages category
****     If this is not done, subsequent calls on the same page will use the last category
****    in the foreach loop
*/   
?>
<?php $layer
->setCurrentCategory($_maincategorylisting);  ?> 
<?endif
;?>   
 
<?endif
;?>                                   
                                                              
<?php         
endif;
endforeach;
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top