I want to override wishlist & compare product grid using plugin. after that i would like to append custom div under class="product-image-container"
.
I try & search a lot but no luck. is there any way to achieve thing?
I try below way for wishlist grid.
Namespace/Modulename/etc/forntend/di.xml
<type name="Magento\Wishlist\Block\Customer\Wishlist\Items">
<plugin name="Namespace_Modulename::wishlistProduct" type="namespace\Modulename\Plugin\Customer\Wishlist\Items" sortOrder="18" />
</type>
Namespace/Modulename/Plugin/Customer/Wishlist/items.php
namespace Namespace\Modulename\Plugin\Customer\Wishlist;
class Items
{
/**
* @var \Magento\Framework\View\LayoutInterface
*/
protected $layout;
public function __construct(
\Magento\Framework\View\LayoutInterface $layout
) { //die('test called');
$this->layout = $layout;
}
public function afterGetColumns(\Magento\Wishlist\Block\Customer\Wishlist\Items $subject, $result
) {
var_dump($subject->getProduct());die('called');
$labelHtml = $this->layout->createBlock('Namespace\Modulename\Block\Label')->setProduct($product)->setTemplate('Namespace_Modulename::product/label.phtml')->toHtml();
return $result.$labelHtml;
}
}
What i missing or wrong in above code?
Edit :
How can i create after plugin for class Magento\Catalog\Block\Product\Compare\ListCompare
?
I try with below way but not working.
<type name="Magento\Catalog\Block\Product\Compare\ListCompare">
<plugin disabled="false" name="Namespace_Modulename::compareProduct" type="Namespace\Modulename\Plugin\Catalog\Product\Compare\ListCompare" sortOrder="19" />
</type>
Any help would be appreciated!