A
A
Alexander2019-02-22 13:02:23
opencart
Alexander, 2019-02-22 13:02:23

How to make a two-way link for products in OpenCart 2.1?

Hello!
Installed one-way linked products module for Opencart to disable automatic two-way linking for products. But you need to make sure that when you manually add feedback, this connection is not destroyed.
An example in the picture. With the module enabled, if I add a registrar to the camera, the registrar will disappear from the camera.
5c6fc80652e59260664263.png
When the module is disabled, everything works, but such links are NOT needed for all products, but only for those where the link is set manually.
I hope I explained the problem in detail. Can anyone help please explain how this can be done.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoozag, 2019-02-22
@zoozag

There, the module simply comments 2 lines:

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

Look in the modified file to see if they are commented out.
Judging by your behavior
$this->db->query("DELETE FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$related_id . "' AND related_id = '" . (int)$product_id . "'");
continues to work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question