for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Richdynamix\PersonalisedProducts\Block\Product;
use \Magento\Catalog\Block\Product\Context;
/**
* Class View
*
* @category Richdynamix
* @package PersonalisedProducts
* @author Steven Richardson ([email protected]) @mage_gizmo
*/
class View extends \Magento\Framework\View\Element\Template
{
* @var \Magento\Framework\Registry
protected $_coreRegistry;
* View constructor.
* @param Context $context
public function __construct(Context $context)
$this->_coreRegistry = $context->getRegistry();
parent::__construct($context, $data = []);
}
* Get current product instance
* @return mixed
public function getProduct()
return $this->_coreRegistry->registry('current_product');
* Get the current products ID for recording the product view
public function getProductId()
return $this->getProduct()->getId();
* Build product view URL for making AJAX calls
* @return string
public function getProductViewUrl()
return $this->getBaseUrl() . "personalised/products/productView/id/" . $this->getProductId();