Здравствуйте всем , вообщем созданы 3 кастомных поля для карточки товара https://prnt.sc/106yo1g
Первые 2 работают нормально.
Поле "Серия" не в какую не хочет записывать данные , но к примеру если в бд добавить значение для товара как на скрине выше , и удалить его уже из админки то связь поля с бд работает ( на удаление)
модель
$this->db->query("DELETE FROM " . DB_PREFIX . "product_apps_2 WHERE product_id = '" . (int)$product_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "product_apps_2 WHERE related_id = '" . (int)$product_id . "'");
if (isset($data['product_apps_2'])) {
foreach ($data['product_apps_2'] as $related_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "product_apps_2 WHERE product_id = '" . (int)$product_id . "' AND related_id = '" . (int)$related_id . "'");
$this->db->query("INSERT INTO " . DB_PREFIX . "product_apps_2 SET product_id = '" . (int)$product_id . "', related_id = '" . (int)$related_id . "'");
//$this->db->query("DELETE FROM " . DB_PREFIX . "product_apps_2 WHERE product_id = '" . (int)$related_id . "' AND related_id = '" . (int)$product_id . "'");
//$this->db->query("INSERT INTO " . DB_PREFIX . "product_apps_2 SET product_id = '" . (int)$related_id . "', related_id = '" . (int)$product_id . "'");
}
}
$this->db->query("DELETE FROM " . DB_PREFIX . "product_apps_3 WHERE product_id = '" . (int)$product_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "product_apps_3 WHERE related_id = '" . (int)$product_id . "'");
if (isset($data['product_apps_3'])) {
foreach ($data['product_apps_3'] as $related_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "product_apps_3 WHERE product_id = '" . (int)$product_id . "' AND related_id = '" . (int)$related_id . "'");
$this->db->query("INSERT INTO " . DB_PREFIX . "product_apps_3 SET product_id = '" . (int)$product_id . "', related_id = '" . (int)$related_id . "'");
//$this->db->query("DELETE FROM " . DB_PREFIX . "product_apps_3 WHERE product_id = '" . (int)$related_id . "' AND related_id = '" . (int)$product_id . "'");
//$this->db->query("INSERT INTO " . DB_PREFIX . "product_apps_3 SET product_id = '" . (int)$related_id . "', related_id = '" . (int)$product_id . "'");
}
}
полная аналогия с apps_2 , где ошибка не пойму.