Question

My products in Magento have attribute Brand. What I need to do is to display a list of Brands in the footer.Something like: Our Brands: Brand 1, Brand 2, Brand 3...

As far as I understand I need somehow retrieve values from Advanced search and display them in footer as a list, but I don't know how to do it. Does anybody have solution for this?

Was it helpful?

Solution

There are several steps to follow

here i am giving detail instruction how to add your custom attribute at footer.

1. you have to create on block to get all your brand product with assign your custom attribute

for block.

$attributes = Mage::getSingleton('eav/config')
    ->getEntityType(Mage_Catalog_Model_Product::ENTITY) // pass your attribute id
    ->getAttributeCollection()
    ->addSetInfo();

foreach ($attributes as $attribute)
{
    if ($attribute->usesSource())
    {
        echo "{$attribute->getFrontendLabel()}:\n";
        foreach ($attribute->getSource()->getAllOptions() as $option)
        {
            echo "  {$option['label']}\n";
        }
        echo "\n";
    }
}

above is print logic you should have to store it one array in return with one variable.

2. create view file in your theme for display purpose and call that block function in that home_logo file.

<?php $_brandsCollection = $this->getBrandsLogoCollection();?>
<div class="block block-layered-nav">
<div class="block-title">
    <strong><span><?php echo $this->__('Brands') ?></span></strong>
</div>
 <div class="block-content" > 
          <div id="Carousel2" class="carousel">
                <div class="button navButton previous" style="display:none;">Back</div>
                <div class="button navButton next" style="display:none;">More</div>
                <div class="container">
                    <div class="items">
                    <?php foreach ($_brandsCollection as $_brand): ?>                    
                        <div class="item">
                            <div class="key caption"></div>
                            <div class="icon">
                                                        <img class="brand-base-logo" alt="<?php echo $_brand->getBrandLogo() ?>" src="<?php echo $_brand->getBrandLogo(); ?>" width="50" height="50">            
                            </div>                    
                            <div class="picture">
                            </div>
                        </div>                            
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </div> <!-- end block content-->            
</div> 

3. Assign that file to footer using your_layout.xml with reference before footer.

<reference name="footer">
       <block type="brand/left" name="brands_logolist" before="-" template="brand/home_logo.phtml" />
  </reference>

Hope you can understand my logic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top