I'm trying to make editing options on the checkout page. Added function by analogy with quantity
public function update_two($cart_id, $option = array()) {
$this->db->query("UPDATE " . DB_PREFIX . "cart SET option = '" . $this->db->escape(json_encode($option)) . "' WHERE cart_id = '" . (int)$cart_id . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'");
}
Then there is an error
Uncaught exception 'Exception' with message 'Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option = '{\"232\":[\"23\"],\"228\":[\"19\"]}' WHERE cart_id = '198' AND custo' at line 1<br />Error No: 1064<br />
UPDATE: line ~ 283
public function updatetwo($cart_id, $option = array()) {
$this->db->query("UPDATE " . DB_PREFIX . "cart SET `option` = '" . $this->db->escape(serialize(json_encode($option))) . "' WHERE cart_id = '" . (int)$cart_id . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'");
}
Line ~ 50 : $options_alt = unserialize($cart['option']);
foreach (json_decode($options_alt) as $product_option_id => $value) {
If anyone needs - everything works