Сообщение #14 makki » 26.01.2021, 12:41
Ошибка 13При дублировании товара, получаем ошибку в логах
Код: Выделить всё
Error (1064) 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 ', last_modify=NOW() WHERE id in ('118') LIMIT 1' at line 1
UPDATE ok_products SET , last_modify=NOW() WHERE id in ('118') LIMIT 1
Исправляется в файле api/Products.php в функции update_product переносом строки
Код: Выделить всё
$result = $this->languages->get_description($product, 'product');
в начало тела условия ниже
чтобы получилось так
Код: Выделить всё
public function update_product($id, $product) {
$product = (object)$product;
$query = $this->db->placehold("UPDATE __products SET ?%, last_modify=NOW() WHERE id in (?@) LIMIT ?", $product, (array)$id, count((array)$id));
if($this->db->query($query)) {
$result = $this->languages->get_description($product, 'product');
if(!empty($result->description)) {
$this->languages->action_description($id, $result->description, 'product', $this->languages->lang_id());
}.......
[b]Ошибка 13[/b]
При дублировании товара, получаем ошибку в логах
[code]Error (1064) 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 ', last_modify=NOW() WHERE id in ('118') LIMIT 1' at line 1
UPDATE ok_products SET , last_modify=NOW() WHERE id in ('118') LIMIT 1[/code]
Исправляется в файле api/Products.php в функции update_product переносом строки
[code]$result = $this->languages->get_description($product, 'product');[/code]
в начало тела условия ниже
[code]if($this->db->query($query)) {[/code]
чтобы получилось так
[code]public function update_product($id, $product) {
$product = (object)$product;
$query = $this->db->placehold("UPDATE __products SET ?%, last_modify=NOW() WHERE id in (?@) LIMIT ?", $product, (array)$id, count((array)$id));
if($this->db->query($query)) {
$result = $this->languages->get_description($product, 'product');
if(!empty($result->description)) {
$this->languages->action_description($id, $result->description, 'product', $this->languages->lang_id());
}.......[/code]
Cоздание и расширение функционала интернет-магазина на платформе OkayCMS 2 (с 3-й и 4-й версией не работаю)