0

If this is a dumb question, apologies - but I'm putting related products on a product, I've moved it from the side bar to the main content area.

All is going well, but its displaying 4 products, I want to show 5.

I found this:

https://stackoverflow.com/questions/16482486/how-to-display-only-3-related-product-on-product-view-page-magento

And none of the options in there work.

Not sure if I'm missing anything hilariously simple, but wondering if anyone had any ideas. Incidentally I don't want to install a plugin/module or whatever for this. Just call 5 products rather than 4.

Thanks, help would be immensely appreciated.

3
  • I find it hard to believe that the accepted answer in the post you reference isn't working. Are you certain that you're editing the right template? ie: related.phtml in the rwd package versus the one in the base package. Also, you said it gives 4 and not 5 related products. If there's no limit imposed on the collection anywhere else in the related products block, then perhaps there really only are 4 related products. Dec 2, 2014 at 17:30
  • 1
    Hey, thanks for your response @vBuck So after all that, I discovered the problem was that the site had an index management lock problem so products weren't being indexed correctly so the product wasn't being applied correctly... I deleted all locks in var/locks and all is well. But thanks, your suggestion put me on the right track in a roundabout way! Magento, the Internet Explorer of the ecommerce world :) Thanks so much for your help, another thing to note down for quirky ways to fix things... Dec 2, 2014 at 17:50
  • Good to know for me also. You should post that as your answer so this question can be closed and helpful to others! Dec 2, 2014 at 17:55

2 Answers 2

0

I know this method

Mage::registry('current_product')->getRelatedProductIds();

You can make a condition using:

count(Mage::registry('current_product')->getRelatedProductIds());

in app/design/frontend/base/default/template/catalog/product/list/related.phtml

Remember to copy the basis for your theme.

0

Thanks for the responses to this - but typically the problem was symptomatic of something else, namely the site I was working on had got itself into an index lock, so any products set to be a related product were not being indexed as such. So therefore wouldn't show as related.

So to fix this I went to var/locks and simply deleted all the locks in there and reindexed everything and all was well.

Thanks for everyones help and the solutions mentioned above do work.

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.