0

Let's say that I have a product that has 15 products that should be related to it.

I go to the admin panel and add those products on the "related products" field. Simple.

Is there a way to have all the other 15 products related to each other as well? Or is the only way to go into each product and add the same related products manually?

2

The related, cross-sells and up-sells are 'one-way' relations. So if A is related to B it doesn't mean that B is related to A. You will have to add manually or through a script B as related to A. You can find here a simple script that helps you do this.

If you want this done automatically when you save a product you can override the functionality of Mage_Catalog_Model_Resource_Product_Link::saveProductLinks() to make the reverse relation also. The lines that insert the relations are:

$bind = array(
    'product_id'        => $product->getId(),
    'linked_product_id' => $linkedProductId,
    'link_type_id'      => $typeId
);
$adapter->insert($this->getMainTable(), $bind); 

You have to make a similar one. Also be careful to what happens on delete, when removing a related product.
[EDIT]
the reverse relation should look like:

$bind = array(
    'product_id'        => $linkedProductId,
    'linked_product_id' => $product->getId(),
    'link_type_id'      => $typeId
);
$adapter->insert($this->getMainTable(), $bind); 
|improve this answer|||||
  • what would the reverse relation look like? – Raphael Rafatpanah Jul 10 '13 at 15:12
  • I've edited my answer. – Marius Jul 10 '13 at 20:50
0

There is a plugin that exist that can create related products for you vs doing it manually- http://www.magentocommerce.com/magento-connect/related-proudcts-manager-7301.html

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.