0

In Magento2 I've enabled the Related Products and Upsell Products blocks. Everything's fine except for the template of the single item. I want to change that to another custom one.

Here in app/design/frontend/Vendor/theme/Magento_Catalog/templates/product/slider/product-slider.phtml

The template for the items in the file above is declared here: $itemTemplate = $block->getData('item_template') ?? 'Magento_Catalog::product/list/item.phtml';

And this template is the same used for the catalog_category_view.xml

If I try to change that item.phtml file with another custom one in the same directory it doesn't work. Is there any way to override this?

Thanks guys.

4
  • What do you mean with "template of the single item", the product page? May 27, 2022 at 15:46
  • I mean the template for the product box(image, wishlist button ecc..) inside the carousel
    – D.D.
    May 27, 2022 at 15:47
  • Inside your theme the file should be named items.phtml inside Magento_Catalog/templates/product/list/items.phtml, inside the Items.phtml there's the generation of the lists of related, upsell , try check the phtml inside there, and rewrite the items.phtml placing the file in the same path on your theme May 27, 2022 at 15:53
  • Hi Alan, I've checked that file, it's inside vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml. Copied it, pasted into app/design/frontend/Magenio/aldo/Magento_Catalog/templates/product/list/items.phtml. I've seen in this file that there's a switch to handle all the cases, tried to change the title for the "Related Products" block but the title stays the same, for example. So I need to figure out how to fix this. However thanks a lot for the quick response :)
    – D.D.
    May 30, 2022 at 7:55

0

Your Answer

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

Browse other questions tagged or ask your own question.