From 971e36f5f1f96665c977cd8e86e1c4104a167380 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Aug 2023 10:20:52 +0200 Subject: [PATCH] FIX API /product/getAttributes --- htdocs/product/class/api_products.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index d114d115e0e51..d08c3cfb77dc6 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1047,21 +1047,21 @@ public function getAttributes($sortfield = "t.ref", $sortorder = 'ASC', $limit = $sql .= $this->db->plimit($limit, $offset); } - $result = $this->db->query($sql); + $resql = $this->db->query($sql); - if (!$result) { - throw new RestException(503, 'Error when retrieve product attribute list : '.$this->db->lasterror()); + if (!$resql) { + throw new RestException(503, 'Error when retrieving product attribute list : '.$this->db->lasterror()); } $return = array(); - while ($result = $this->db->fetch_object($query)) { + while ($obj = $this->db->fetch_object($resql)) { $tmp = new ProductAttribute($this->db); - $tmp->id = $result->rowid; - $tmp->ref = $result->ref; - $tmp->ref_ext = $result->ref_ext; - $tmp->label = $result->label; - $tmp->position = $result->position; - $tmp->entity = $result->entity; + $tmp->id = $obj->rowid; + $tmp->ref = $obj->ref; + $tmp->ref_ext = $obj->ref_ext; + $tmp->label = $obj->label; + $tmp->position = $obj->position; + $tmp->entity = $obj->entity; $return[] = $this->_cleanObjectDatas($tmp); }