Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How can i set related products programmicaly
 
milenasecret
Jr. Member
 
Total Posts:  5
Joined:  2010-01-27
 

Could anyone plese tell me how to set related products from code.
I have created object
$product = new Mage_Catalog_Model_Product();
$product->setCategoryIds(array(3));
$product->setWebsiteIDs(array(1));
$product->setStatus(1);
$product->setTaxClassId(0);
//.................
//I have tried using:
//$product->setRelatedProducts(array(1,4,5));
//where 1,4,5 are product id, but this did not work

$product-> save();

 
Magento Community Magento Community
Magento Community
Magento Community
 
Incognito
Guru
 
Total Posts:  322
Joined:  2008-08-07
Michigan
 

you should use the core api

http://www.magentocommerce.com/wiki/doc/webservices-api/api#product_links_api_related_cross_sells_up_sells

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top