I need to set a particular product as related product for all the products.Here is the code that I've tried.
$product=$observer->getProduct();
$id=52;
$data=array(
$id=>array(
'position'=>2
)
);
$p=Mage::getModel('catalog/product')->load($product->getId());
$p->setRelatedLinkData($data);
$p->save();
But I get error
Fatal error: Maximum function nesting level of '100' reached, aborting! in /var/www/magento/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php on line 205
Any pointers would be helpful.