can anyone tell me, which class I have to extend if I want to use custom functions in list.phtml?

Thx, Christian

1 Answer 1

<block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">

So you have to rewrite : Magento/Catalog/Block/Product/ListProduct.php

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <preference type="Vender\Module-name\Block\Product\ListProduct"  for="Magento\Catalog\Block\Product\ListProduct"/>

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.