I want to add an extra tab on product detail page just like review tab, It will look like a product question tab. How can I do this?
My block file:
namespace Example\ProductQuestion\Block;
use Example\Framework\View\Element\Template;
class Question extends Template
{
private $_productCollectionFactory;
public function __construct (
Template\Context $context,
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
array $data = []
) {
parent::__construct($context, $data);
$this->_productCollectionFactory = $productCollectionFactory;
}
public function getProduct()
{
$collection = $this->_productCollectionFactory->create();
$collection->addAttributeToSelect('*')
->setOrder('created_at')
->setPageSize(5);
return $collection;
}
}