I am using an extension auto-selecting related products from the same category. However, I want to exclude the current product from that list which is not really working.
protected $_categoryFactory; protected $_registry; $collection = $this->getRelatedProductsCollection($result);
I am getting the current product and ID like that:
$product = $this->_registry->registry('current_product'); $productId = $product->getId();
And then I tried to exclude it like that:
$collection ->removeItemByKey($productId); $collection ->getSelect()->orderRand();
But I still can see the current product somewhere in the list. What do I need to change to exclude the current product?