I succesfully moved the product related block in my page layout with

<move element="catalog.product.related" destination="product.info.right" after='-'/>

I want now to apply a custom template to this block:

product/list/mytemplate.phtml instead of product/list/items.phtml How can I do?

I tried adding also

<block class="Magento\Catalog\Block\Product\ProductList\Related" name="product.review.related" template="product/list/items.phtml" />

but it don't works.

  • Than you, but not completely, see my new comment
    – domfitty
    Commented May 1, 2019 at 9:44

3 Answers 3


You should try with reference block method.

<referenceBlock name="product.review.related">
    <argument name="template" xsi:type="string">[Vendor]_[Module]::product/list/items.phtml</argument>

In above name="" write your block identifier name. and name="" in argument pass tempalte.

Or you can set a template in the block file.

echo $this->getLayout()

Here I am sharing knowledge of how to set a custom template to block. template path and block identifier should be changed as per your requirement.

I hope it helps!

  • I tried the following code ` <referenceBlock name="catalog.product.related"> <arguments> <argument name="template" xsi:type="string">Magento_Catalog::product/list/altriformati.phtml</argument> </arguments> </referenceBlock> ` but template is always Magento_Catalog::product/list/items.phtml Here devtools results name catalog.product.related type block class Magento\Catalog\Block\Product\ProductList\Related template Magento_Catalog::product/list/items.phtml module Magento_Catalog
    – domfitty
    Commented May 1, 2019 at 9:40
  • Okay, nop. as per my answer I mentioned, I am sharing just knowledge. not an exact solution. :) Commented May 1, 2019 at 9:53

You should indicate the specific Module location of your template:

<block class="Magento\Catalog\Block\Product\ProductList\Related" name="product.review.related" template="Vendor_Module::product/list/items.phtml" />

Just for Knowledge share: I used the following code to load related product collection and show results in a custom way (only "formato" field)

$relatedProducts = $_product->getRelatedProductCollection()

<?php if ((count($relatedProducts)) != 0): ?>
<div class="altriformati">
    <h4 class="categorie">Altri formati disponibili:</h4>
    <?php foreach ($relatedProducts as $relatedProduct) {?>
    <a href="<?php echo $relatedProduct->getProductUrl(); ?>" title="acquista anche nel formato <?php echo $relatedProduct->getAttributeText('formato'); ?>">    
    <img src="<?php echo $store->getBaseUrl();  ?>pub/media/formati/<?php echo $relatedProduct->getAttributeText('formato'); ?>.png" alt="disponibile nel formato <?php echo $relatedProduct->getAttributeText('formato'); ?>" class="detail-icon"/>
    <?php echo $relatedProduct->getAttributeText('formato'); ?>
    <?php } ?>
<?php endif;?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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