Post by mrbken » Thu Jun 28, 2012 6:00 pm

I am trying to remove the reciprocal relationship between related products.

Following the advice in this earlier forum : ... 25#p265525

I have made the following amends to: admin/model/catalog/product.php


Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "product_related SET product_id = '" . (int)$related_id . "', related_id = '" . (int)$product_id . "'");

Code: Select all

$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$related_id . "' AND related_id = '" . (int)$product_id . "'");
This has had the desired effect and related products are no longer automatically linked.

i.e. I can make PRODUCT A be related to PRODUCT B, without PRODUCT B being related to PRODUCT A.

This is great...

However, in the instances where I require a reciprocal relationship, it is not possible.

What I hope to achieve is not to remove this as an option entirely, as the above code seems to do. Only, I hope to make the two way relationship not automatic.

Any advice on how to solve this would be greatly appreciated.




Fri Sep 23, 2011 4:35 pm

Post by PaulD123 » Thu Nov 29, 2012 10:25 pm

I decided not to bother (sorry) and left it as unreciprocal, however I can see how it might be useful.

I suppose you could add an extra checkbox onto the product_form. Instead of deleting the reciprocal lines you could surround them in an if clause, where the reciprocal lines are done if checked, and skipped if not.

Ideally though the solution would be more complicated in my opinion. There should be a checkbox by each product you add to the related, so that you can choose to reciprocate the related item or not, item by item.

I only discovered the reciprocal item when a base product I linked to from all my other products suddenly had fifty or so related items. At first I was a bit confused, but agree there are times when 'reciprocity' would be a good idea.

It might also be good to have a limit in the options for maximum number of related products - just in case!


This would be a fantastic mod if anyone cares to program it. However I try to leave any ajax stuff well alone as from experience it is mightily tricky to avoid errors when messing with the more complex stuff like ajax :-(



Tue Jul 05, 2011 11:58 pm
Who is online

Users browsing this forum: No registered users and 19 guests