Post by make-oc » Mon Apr 20, 2009 12:11 pm

Hi there

Just went from 1.2.5 to 1.2.6, so I could use the new feature "Related Products". Now as I went on and about I had to realize this works only "one way", meaning when you relate the Nikon D300 to the iMac – in the Demo Shop – the iMac will list the Nikon D300 in Related Products, but the Nikon D300 will not list the iMac.
Now from my point of view this does not make sense as this is not a true relationship, which always works both ways. This more a "attached to" situation, which means you have to "attach" every product twice — not a very efficient way to set up your products, I'd say…

OK, some may like it that way, but I'd see them very much being the minority.


Also, I had just spent hours getting this "Related Products contrib" http://forum.opencart.com/viewtopic.php ... 537#p17285 working on 1.2.5, as I did not know this would be a native function in 1.2.6 This contrib by Henry does indeed work both ways!

Any thoughts, solution on this?

Cheers

New member

Posts

Joined
Tue Apr 07, 2009 2:17 pm

Post by make-oc » Sun Apr 26, 2009 2:47 pm

JNeuhoff said
You could edit the file /admin/model/catalog/product.php so as to make sure each time a product gets added or updated it will enter the related products in both ways.
in http://forum.opencart.com/viewtopic.php ... 804#p18296

I don't think it should be done this way, as this will create 50% redundancy. May not too bad as the table "product_related" only consists of

Code: Select all

  `product_id` int(11)
  `related_id` int(11)
So, if I'm not too confused — it's all there, right?
It seems more a matter of doing the right select… it's just that I can not get may head around altering this function:

Code: Select all

public function getProductRelated($product_id) {
        $query = $this->db->query("SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM product_related pr LEFT JOIN product p ON (pr.related_id = p.product_id) LEFT JOIN product_description pd ON (p.product_id = pd.product_id) LEFT JOIN manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN stock_status ss ON (p.stock_status_id = ss.stock_status_id) LEFT JOIN product_to_category p2c ON (p.product_id = p2c.product_id) WHERE pr.product_id = '" . (int)$product_id . "' AND p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->language->getId() . "' AND ss.language_id = '" . (int)$this->language->getId() . "' ORDER BY pd.name ASC");
       
        return $query->rows;
    }
so the whole thing works both ways

Would be great if someone could give a hand

Cheers

New member

Posts

Joined
Tue Apr 07, 2009 2:17 pm

Post by tommix » Mon Apr 27, 2009 12:37 am

it's really a "problem" in almost all shops :) and if dev will make it as you want -it would be very nice feature :)

Active Member

Posts

Joined
Mon Apr 20, 2009 5:21 am
Who is online

Users browsing this forum: No registered users and 316 guests