diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2188293a1ba..749899e345c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2014 Henry Florian * Copyright (C) 2014 Philippe Grand * Copyright (C) 2014 Ion agorria + * Copyright (C) 2016 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1673,7 +1674,7 @@ class Product extends CommonObject $sql.= " WHERE entity IN (".getEntity('productprice', 1).")"; $sql.= " AND price_level=".$i; $sql.= " AND fk_product = '".$this->id."'"; - $sql.= " ORDER BY date_price, rowid DESC"; + $sql.= " ORDER BY date_price DESC, rowid DESC"; $sql.= " LIMIT 1"; $resql = $this->db->query($sql); if ($resql)