1

What is the best practice for removing template files that have been defined in PHP files?

For example I want to remove helper/summary_short.phtml on category pages, normally I'd remove the block via XML. But I can't do this as the template isn't defined in a block, it's defined in PHP.

vendor/magento/module-review/Block/Product/ReviewRenderer.php

/**
     * Array of available template name
     *
     * @var array
     */
    protected $_availableTemplates = [
        self::FULL_VIEW => 'helper/summary.phtml',
        self::SHORT_VIEW => 'helper/summary_short.phtml',
    ];
2

I figured this out right after finishing the question, the template is also called within vendor/magento/module-catalog/view/frontend/templates/product/list.phtml - line 72.

<?php echo $block->getReviewsSummaryHtml($_product, $templateType); ?>

I removed this in my own template file successfully removed the template - app/design/frontend/**VENDOR**/**THEME**/Magento_Catalog/templates/product/list.phtml

| improve this answer | |

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.