Magento Forum

Kategoriebilder aus Unterkategorie anzeigen
 
brainwatcher
Jr. Member
 
Total Posts:  24
Joined:  2009-01-30
 

Wie kann ich die Bilder der Unterkategorien in der Elternkategorie anzeigen lassen?
Die Links für die Unterkategorien werden bereits erzeugt und angezeigt,
allerdings liefert mir

$_category->getImageUrl()
nur NULL zurück…

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

<div class="listing-type-list catalog-listing">
    
<?php foreach ($_categories as $hold => $_category): ?>
  
    
<table cellspacing="0" cellpadding="0" style="border: 1px solid red; width: 100%;">
            
<?php if($_category->getIsActive()): ?>
            
<tr>
                <
td style="border: 1px solid blue; padding: 10px; text-align: center;">
                    <
a style="font-size:16px;font-weight:bold;color:#00287A;" href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                        
<?php echo $this->htmlEscape($_category->getName()) ?>
                    
</a>
                </
td>
                <
td style="border: 1px solid blue; padding: 10px; text-align: center;">
                    <
a style="font-size:16px;font-weight:bold;color:#00287A;" href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                        
<?php echo $this->htmlEscape($_category->getName()) ?>
                    
</a>
                </
td>
                <
td style="border: 1px solid blue; padding: 10px; text-align: center;">
                    <
a style="font-size:16px;font-weight:bold;color:#00287A;" href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                        
<?php echo $this->htmlEscape($_category->getName()) ?>
                    
</a>
                    
                        
<?php 
                            
echo $this->htmlEscape($_category->getImageUrl()).")))"
                            echo 
get_class($_category); 
                            echo 
$_category->getCategoryIdUrl();

                            
?>

Gibt es evtl. eine Methode um eine Kategorie per ID zu initialisieren?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rico Winter
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-20
Leipzig
 

Schau dir das mal an http://www.magentocommerce.com/boards/viewthread/9632/ , vielleicht hilft es dir ja weiter.

Gruß Rico

 
Magento Community Magento Community
Magento Community
Magento Community
 
brainwatcher
Jr. Member
 
Total Posts:  24
Joined:  2009-01-30
 

Danke, konnte es zwischenzeitlich anders lösen:

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

<div class="listing-type-list catalog-listing">
    
<?php 
    
foreach ($_categories as $hold => $_category)
    
{
    
    
// Erstelle Model um Zugriff auf Daten der Sub-Kategorien zu haben
                    
$CategoriesApi = new Mage_Catalog_Model_Category_Api();
                    
$catId $_category->getData();
                    
$catId $catId['entity_id'];

                    
// Hole Infos für die aktuelle Sub-Kategorie
                    
$subCategory $CategoriesApi->info($catId);
                    
$imageName $subCategory['image'];
                    
$imageUrl Mage::getBaseUrl('media').'catalog/category/'.$imageName;
    
?>
  
    
<table cellspacing="0" cellpadding="0" style="border: 1px solid red; width: 100%;">
            
<?php if($_category->getIsActive()): ?>
            
<tr>
                <
td style="border: 1px solid blue; padding: 10px; text-align: center;">
                    <
a style="font-size:16px;font-weight:bold;color:#00287A;" href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                        
<?php echo $this->htmlEscape($_category->getName()) ?>
                    
</a>
                </
td>
                <
td style="border: 1px solid blue; padding: 10px; text-align: center;">
                    <
a style="font-size:16px;font-weight:bold;color:#00287A;" href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                        
<?php echo $this->htmlEscape($_category->getName()) ?>
                    
</a>
                </
td>
                <
td style="border: 1px solid blue; padding: 10px; text-align: center;">
                    <
a style="font-size:16px;font-weight:bold;color:#00287A;" href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                        
<?php echo $this->htmlEscape($_category->getName()) ?> <img src="<?= $imageUrl ?>" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>" />
                    </
a>
                </
td>
            
<?php endif; ?>
            
</tr>
    </
table>
    
<?php } // end foreach?>
</div>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top