Thursday, 25 July 2013

Magento - How to put text under the .More-View images

Magento - How to put text under the .More-View images


  1. Locate the file which is media.phtml - folder structure. app/design/frontend/default/(your-theme)/template/catalog/product/view/media.phtml  
  2. Open the file, then look for <div class="more-views"> it should be near the bottom of the page. Mine looks like

<div class="more-views">
    <?php /*?><h2><?php echo $this->__('More Views') ?></h2><?php */?>
    <ul id="more">
    <?php foreach ($this->getGalleryImages() as $_image): ?>

<li><a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>"  rel="image_gallery" title="<?php echo $_product->getName();?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(70, 70); ?>" width="70" alt=""/></a>    
            
        </li>
       
    <?php endforeach; ?>
    </ul>
</div>

That is in version 1.7.0.2

All you need to do now is add this in :     
 <!-- begin image text -->

            <br />
            <span>
                <?php echo $this->htmlEscape($_image->getLabel()) ?>
            </span>

            <!-- end image text -->

So overall it look like. (This is correct for 1.7.0.2) You should be able to just copy out yours and put in this bit. Make sure you always backup just in case.

<div class="more-views">
    <?php /*?><h2><?php echo $this->__('More Views') ?></h2><?php */?>
    <ul id="more">
    <?php foreach ($this->getGalleryImages() as $_image): ?>

<li><a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>"  rel="image_gallery" title="<?php echo $_product->getName();?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(70, 70); ?>" width="70" alt=""/></a>

            <!-- begin image text -->

            <br />
            <span>
                <?php echo $this->htmlEscape($_image->getLabel()) ?>
            </span>

            <!-- end image text -->
            
        </li>
       
    <?php endforeach; ?>
    </ul>
</div>

No comments:

Post a Comment