I want to add text after image on product list page. For that I created plugin for getImage() function of vendor/magento/module-catalog/Block/Product/AbstractProduct.php
Plugin Code:
<?php
namespace Vendor\Module\Model;
class Product extends \Magento\Catalog\Block\Product\AbstractProduct
{
public function afterGetImage(\Magento\Catalog\Model\Product $subject, $result)
{
$result .= 'Testing From Plugin';
return $result;
}
}
But I'm getting this error:
Uncaught TypeError: Argument 2 passed to Magento\Catalog\Block\Product\AbstractProduct::__construct() must be of the type array, object given
What I am doing wrong?
Argument 1 passed to Module\Model\Product::afterGetImage() must be an instance of Magento\Catalog\Model\Product, instance of Magento\Catalog\Block\Product\ListProduct\Interceptor given,