Can’t get related products along with Add to Wish List and Add to Compare buttons.
These buttons are missing if I create a block in the way described below. What am I doing wrong?
<?php
declare(strict_types = 1);
namespace VendorModulePlugin;
use MagentoCatalogBlockProductProductListRelated;
use MagentoFrameworkViewLayoutInterface;
class SomeClass
{
/**
* @var MagentoFrameworkViewLayoutInterface
*/
protected $layout;
/**
* @param MagentoFrameworkViewLayoutInterface $layout
*/
public function __construct(LayoutInterface $layout)
{
$this->layout = $layout;
}
/**
* @return mixed
*/
public function setRelated()
{
return $this->layout->createBlock(Related::class)
->setTemplate('Magento_Catalog::product/list/items.phtml')
->setType('related')
->toHtml();
}
}