[1.2.9] [1.2.8] Bug in /catalog/model/catalog/product.php
Posted: Tue Jun 30, 2009 8:58 pm
The following database queries in /catalog/model/catalog/product.php don't always match up in the number of products returned. This bug exists both in Opencart 1.2.8 and 1.2.9.
E.g. in Opencart 1.2.8 it would be something like this:
- getProductsByCategoryId
getTotalProductsByCategoryId
E.g. in Opencart 1.2.8 it would be something like this:
Code: Select all
public function getTotalProductsByCategoryId($category_id = 0) {
$sql = "SELECT COUNT(*) AS total FROM product_to_category p2c LEFT JOIN product p ON (p2c.product_id = p.product_id) LEFT JOIN stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE p.status = '1' AND p.date_available <= NOW() AND ss.language_id = '" . (int)$this->language->getId() . "' AND p2c.category_id = '" . (int)$category_id . "'";
$query = $this->db->query( $sql );
return $query->row['total'];
}