Skip to content

Commit

Permalink
FIX API /product/getAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 26, 2023
1 parent a47bc21 commit 971e36f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions htdocs/product/class/api_products.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 971e36f

Please sign in to comment.