I am displaying related products in content block of layout in product view page. My code in catalog.xml is:
<reference name="content">
<block type="catalog/product_list_related" name="catalog.product.related" after="-" template="catalog/product/list/related.phtml"/>
</reference>
Now, all the related products are displayed in my product view page, but I want to display only 3 products, What should I do? Please, anybody can help ??
You also need to go to all products page in backend and navigate what product you want to remove its related items. After that, unmark the checkbox of the product you want to remove and then save your selection.
You need to edit the template file catalog/product/list/related.phtml
and limit the loop to only iterate through 3 products.
For example:
...
<?php $i = 0; ?>
<?php foreach($this->getItems() as $_item): ?>
<?php if($i++ == 3) break; ?>
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With