Magento is only displaying 3 related products; I'm looking to display 5. What am I doing wrong/What do I need to change?

  • have you set more then 3 related products in admin side for particular product ? – Abdul Dec 23 '15 at 5:04
  • 1
    This page ranks well for the question but the answers are not good. You set it using the XML, here is the answer -> stackoverflow.com/questions/31449799/… – McNab Jan 5 '18 at 15:56
  • First check your package & theme name, Admin Panel -> System ->Config -> Design
  • Then go to your magento folder location, and edit the file app/design/frontend/YOUR PACKAGE/YOUR THEME/template/catalog/product/list/related.phtml
  • If the file is not there, then go to app/design/frontend/base/default/template/catalog/product/list/related.phtml
  • In that file, check for the count
| improve this answer | |
  • Where is the count? – azhang24 Aug 11 '15 at 5:30

You must be change in your themes,


check If count mentioned 3, change it to 4,5 or the number of products you want. Let me know if it works


Replace the

    tag which starts on line number 34, with the following code

    <ol class="mini-products-list" id="block-related">
    <?php $i=0; ?>
        <?php foreach($this->getItems() as $_item): ?>
        <?php if($count!=6){ ?>
            <li class="item">
                <?php if(!$_item->isComposite() && $_item->isSaleable()): ?>
                    <?php if (!$_item->getRequiredOptions()): ?>
                        <input type="checkbox" class="checkbox related-checkbox" id="related-checkbox<?php echo $_item->getId() ?>" name="related_products[]" value="<?php echo $_item->getId() ?>" />
                    <?php endif; ?>
                <?php endif; ?>
                <div class="product">
                    <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
                    <div class="product-details">
                        <p class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></p>
                        <?php echo $this->getPriceHtml($_item, true, '-related') ?>
                        <?php if ($this->helper('wishlist')->isAllow()) : ?>
                            <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
                        <?php endif; ?>

Hope this helps.

| improve this answer | |
  • Where is the count? – azhang24 Aug 11 '15 at 15:36
  • I ve edited my answer. Please take a look. – Sundar Aug 12 '15 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.